????д?????????????????SQL????????????????????????????????????????дSQL???????????????????б????????sql??????????????????????д?????????????????????????????дд????Щ?????SQL SERVER2008??????????????
?????????????????SQL???
????1 select
????2 top 10 *
????3 from Student
????4 where age>20
????????SQL????????????????????????
??????1?????Student???????age>20?????????????Щ?????????????10???????
??????2?????Student????????10?????????????Щ?????????age>20???????
????????????????????????????????????????????????1?????????????????????????????????????????????????????????Щ??SQL?????????????SQL????????????????????????????????????SQL??????д???????SQL????б????????SQL???????????????
????????????????????????SQL???
select
distinct
top 1
Table1.id??COUNT(Table1.name) as nameCount
from Table1
inner join Table2
on Table1.id=Table2.id
where Table1.id<4
group by Table1.id
having Table1.id<3
order by Table1.id desc
????????Table1??Table2??????????????????????????????????????ū?Щ?????????????????????????????????????????????????????SQL??????????Table1??Table2???£?

??????????????????SQL???????????????н???
??????8??????select
??????9??????distinct
??????11??????top 1
??????6????  Table1.id??COUNT(Table1.name) as nameCount
??????1??????from Table1
??????3??????inner join Table2
??????2??????on Table1.id=Table2.id
??????4??????where Table1.id<4
??????5??????group by Table1.id
??????7??????having Table1.id<3
??????10??????order by Table1.id desc