hive 学习

多表查询

SELECT
a.user_uid_type,
a.user_uid,
c.user_id,
c.user_type
FROM
mytable1 a
JOIN mytable2 b
ON(a.user_uid_type = b.user_type AND a.user_uid = b.user_id)
JOIN mytable3 c
on(b.device_id = c.device_id)
WHERE a.date='' AND b.date='' AND c.date='' SORT BY rand() LIMIT

给列起别名需要加AS

SELECT xxx_id AS id FROM yourtable

多列去重选择

SELECT DISTINCE col1, col2 FROM yourtable

left join 和 left outer join区别

这两个其实是一样的,left join是 left outer join的简称

join和left join的区别

比如有两个表

table1

name  age
jack   
bob   
kate    table age career   student
  doctor 那么table1 LEFT JOIN table2就是 name  age  career
jack       student
bob       NULL
kate       NULL 如果table1 JOIN table2 就是 name  age  career
jack     student
上一篇:Django搭建及源码分析(一)


下一篇:Photon开发实战(2)——开发框架、第一个Photon程序