Possible Duplicate:
Simple SQL Select from 2 Tables (What is a Join?)
i have a sql query question. Two tables:
Location
lid State
--- -----
1 MI
2 FL
3 CA
Time
tid lid
a 1
b 1
c 2
d 2
e 3
f 3
Now I want to connect those two tables. If I do:
select l.lid, l.state, t.tid
from location l, time t
where l.lid=t.lid
Then it will give me this result:
lid state tid
--- ----- ---
1 MI a
1 MI b
2 FL c
2 FL d
3 CA e
3 CA f
Instead of getting this, I want to have this result:
lid state tid1 tid2
--- ----- ---- ----
1 MI a b
2 FL c d
3 CA e f
How should I write the query?
Also, assume that in the Time table there would be exactly two records for each lid.