so confused with not knowing exactly which to use - seen loads of qs on this but im sure it must be simple
table 1 consists of
id | cat | name
1 | 1 | notinterested
2 | 2 | name a
3 | 2 | name b
4 | 2 | name c
5 | 3 | notinterested
2nd table
id | catid | url
1 | 2 | a.jpg (name a)
2 | 2 | b.jpg (name a)
3 | 2 | c.jpg (name a)
4 | 3 | d.jpg (name b)
5 | 3 | e.jpg (name b)
6 | 3 | f.jpg (name b)
7 | 4 | g.jpg (name c)
8 | 4 | h.jpg (name c)
9 | 4 | i.jpg (name c)
the catid in 2nd table is based on the original id from the first table
so basically what i need to do is select everything from table one that has cat=2 and display that name next to its 1st corresponding url from table 2
so the echo result would be
name a - a.jpg
name b - d.jpg
name c - g.jpg
if this makes any sense whatsoever
solved
SELECT table1.cat, table1.id, table2.id, table2.url, table2.catid FROM table1 LEFT OUTER JOIN table2 ON table2.catid = table1.id WHERE table1.cat = '2' GROUP BY table2.catid