udacity新课程Introduction to programming in Java# Java - 爪哇娇娃
n*u
1 楼
Sorry to bother High Hands here.
Two tables, a, b
a has uid(userid), gid(groupid), date, active
b has uid, gid, date(it's different from a.date)
a and b have some common uid and gid.
If I want to combine these two tables:
SELECT a.gid as gid, a.uid as uid
FROM a
UNION
SELECT b.gid as gid, b.uid as uid
FROM b
Right now, I have this table which has all uid and gid (distinct)
Then I want to get a table with columns uid, gid, date(if b has date, use b.
date), active
How can I do?
Thanks
Two tables, a, b
a has uid(userid), gid(groupid), date, active
b has uid, gid, date(it's different from a.date)
a and b have some common uid and gid.
If I want to combine these two tables:
SELECT a.gid as gid, a.uid as uid
FROM a
UNION
SELECT b.gid as gid, b.uid as uid
FROM b
Right now, I have this table which has all uid and gid (distinct)
Then I want to get a table with columns uid, gid, date(if b has date, use b.
date), active
How can I do?
Thanks