A strange SQL statement

Source: Internet
Author: User

 

 Create   Table Test77 (djbh Varchar ( 10 ), SPDM Varchar ( 10 ), SL Int  )  Insert   Into Test77 Values ( '  Ja001  ' ,'  A  ' , 4  )  Insert   Into Test77 Values ( '  Ja001  ' , '  B  ' , 3  ) Insert   Into Test77 Values ( '  Ja002  ' , '  A  ' , 5  )  Insert   Into Test77 Values ( '  Ja003 ' , '  A  ' , 2  )  Insert   Into Test77 Values ( '  Ja004  ' , '  A  ' , 2 )  Insert   Into Test77 Values ( '  Ja005  ' , '  A  ' , 2  )  Insert   Into Test77 Values ( ' Ja006  ' , '  A  ' , 2 )

 

Select max (djbh) from test77 A where 17> = (select sum (SL) from test77 B where. djbh> B. djbh and. SPDM = B. SPDM) and SPDM = 'A' this syntax is very strange, do not understand ..

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.