Multi-conditional query _linq in LINQ

Source: Internet
Author: User

Multi-Criteria query in LINQ:

from S in data4
Join D1 in Data_co on new {S.forecasttime,s.regioncode}

equals new {D1. Monidate, D1. Regioncode}
But this only implements a join association, and an error occurs when there are multiple joins.

Modified as follows: Join D1 in Data_co on S.forecasttime equals D1. Monidate
where S.REGIONCODE==D1. Regioncode

An association that implements multiple join multiple conditions


var data7 = (from S in data4
Join D1 in Data_co on S.forecasttime equals D1. Monidate
where S.REGIONCODE==D1. Regioncode
Join D2 in Data_no2 on S.forecasttime equals D2. Monidate
where S.regioncode = = D2. Regioncode
Join D3 in Data_so2 on S.forecasttime equals D3. Monidate
where S.regioncode = = D3. Regioncode
Join D4 in Data_o3 on S.forecasttime equals D4. Monidate
where S.regioncode = = D4. Regioncode
Join D5 in data_o38h on S.forecasttime equals D5. Monidate
where S.regioncode = = d5. Regioncode
Join D6 in Data_pm10 on S.forecasttime equals D6. Monidate
where S.regioncode = = d6. Regioncode
Join D7 in DATA_PM25 on S.forecasttime equals D7. Monidate
where S.regioncode = = D7. Regioncode
Select New
{
Regioncode = S.regioncode,
Forecasttime = S.forecasttime,
Regionname = S.regionname,
CO = (decimal) d1.co,
NO2 = (short) d2. NO2,
SO2 = (short) D3. SO2,
O3 = (short) D4. O3,
o38h = (short) d5. O38H,
PM10 = (short) d6. PM10,
PM25 = (short) D7. PM25
}). (a => A.regioncode);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.