postgresql联合查询、连接查询
[*]联合查询
select* from cw.cities c,(select state, MAX(pop) maxFROM cw.citiesgroup by state) twhere t.state = c.state and t.max=c.pop
selectc.* from cw.cities c,(select state, MAX(pop) maxFROM cw.citiesgroup by state) twhere t.state = c.state and t.max=c.pop
[*]left join on and
selectc.* from cw.cities c left join (select state, MAX(pop) maxFROM cw.citiesgroup by state) ton t.state = c.state and t.max=c.pop
[*]left join on where
selectc.* from cw.cities c left join (select state, MAX(pop) maxFROM cw.citiesgroup by state) ton t.state = c.state where t.max=c.pop
[*]inner join on and
selectc.* from cw.cities c inner join (select state, MAX(pop) maxFROM cw.citiesgroup by state) ton t.state = c.state and t.max=c.pop
页:
[1]