select t.Brand,s.Id
from T_Customers as t join T_Seats as s on t.Id=s.Id
select t.Brand,s.Id
from T_Customers as t join T_Seats as s on t.Id=s.Id
where t.Age>(select AVG(age) from T_Customers)
//子查询
select * from T_Customers
select * from
(
select * from T_Customers
)as s1
In的用法
select * from T_Customers
where Id in(1)
单列多行
select * from T_Customers
where id in
(
select BuyDate from T_Customers
)
分页相关的列
select ROW_NUMBER() over(order by Id DESC) AS rownum,
* from T_Customers
select * from
(select ROW_NUMBER() over(order by Id DESC) AS rownum,
* from T_Customers) as e1
where e1.rownum>1