SQL常用语法

1、distinct去除重复项,s,d别名,order by s.time desc以时间逆序排列

select distinct s.time,d.area

    from server.table s,device.table d

  where s.id = d.id

    and s.time > '2017-04-25' 

  order by s.time desc

 

2、left join,right join,inner join,左、右、内连接

select s.*,d.* from s left join d

    on s.id = d.id

posted @ 2017-04-25 23:03  随便了888  阅读(123)  评论(0编辑  收藏  举报