[Continue to supplement]

Source: Internet
Author: User

1. In statement
I tried it many times. It seems that the in statement does not generate in statements, but can only be changed.

For example, to find out the "Mobile Phone category" and "all sub-classes of mobile phone" Products (mobile phone category ID for D0C37275-2279-4590-A679-C65A4F28918F)

Select F_id, f_name, f_clsid From T_product Where F_clsid In (
  Select F_id From T_class Where F_id = ' D0C37275-2279-4590-A679-C65A4F28918F '   Or F_parentidstr Like   ' % D0C37275-2279-4590-A679-C65A4F28918F % ' )

The effect is equivalent

Select P.f _ id, p.f _ name, p.f _ CLSID From T_product As P Inner   Join T_class As C On C. f _ id = P.f _ CLSID Where  
C. f _ id = ' D0C37275-2279-4590-A679-C65A4F28918F '   Or C. f _ parentidstr Like   ' % D0C37275-2279-4590-A679-C65A4F28918F % '

Or

Select P.f _ id, p.f _ name, p.f _ CLSID From T_product As P, t_class As C Where  
P.f _ CLSID = C. f _ id And (
C. f _ id = ' D0C37275-2279-4590-A679-C65A4F28918F '   Or  
C. f _ parentidstr Like   ' % D0C37275-2279-4590-A679-C65A4F28918F % ' )

Equivalent Writing Method of LINQ to SQL:

VaR Query = From P In DB. t_products join
C In DB. t_classes on p. f_clsid equals C. f_id
Where C. f_id =   New GUID ( " D0C37275-2279-4590-A679-C65A4F28918F " ) | C. f_parentidstr.contains ( " D0C37275-2279-4590-A679-C65A4F28918F " )
Select New   {P. f_id, P. f_name} ;

Or

VaR Query = From P In DB. t_products
From C In DB. t_classes
Where P. f_clsid = C. f_id && (C. f_id =   New GUID ( " D0C37275-2279-4590-A679-C65A4F28918F " ) | C. f_parentidstr.contains ( " D0C37275-2279-4590-A679-C65A4F28918F " ))
Select New   {P. f_id, P. f_name} ;

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.