Hey guys... im trying to get out some data and join two tables.
table1 - processes
processID name
====================
1.01 feed fish
1.02 feed dog
2.01 do shopping
2.02 clean house
table2 - results
processID userid answer
======================
1.01 321 3
1.02 321 2
1.01 435 1
2.02 435 7
2.01 665 4
I need to do a join to get the data from table 2 (results) but also lookup the process name... so my results should be (by user - where say userid = 321)
export: userID = 321
process your answer
=================
feed fish 3
feed dog 2
at the mo, I can get the first results ok but for some reason when I join, I get far too many results back!! here's the code I'm using
SELECT
pr.name as name,
an.answer as answer
FROM answers an, processes pr
WHERE an.processID = pr.processID
AND an.userID=321
i was expecting 2 results for example, but i get hundreds....
[edit]
basically, all I need to do is lookup the NAME of the processID for each record in the answers table!!
[/edit]