OK, so the title sounds a little confusing. Here's the situation:
I have two tables, one is a list of items, e.g:
The second lists people against the items, e.g. people who have ordered the items:
My question is, I want to select ALL the records in table 1 with the notes for a particular user at the end of each record, e.g:
Which works for user x123, but for user a123 it would only return the one row that they have an entry for. My question is how do I make it select all the rows in table1 for user a123 with Null as the notes field for any they do not have an entry for?
TIA.
C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!
I have two tables, one is a list of items, e.g:
Code:
id | description
----------------
1 | Item 1
2 | Item 2
The second lists people against the items, e.g. people who have ordered the items:
Code:
username | itemno | notes
--------------------------
x123 | 1 | Note 1
x123 | 2 | Note 2
a123 | 2 | Note 3
My question is, I want to select ALL the records in table 1 with the notes for a particular user at the end of each record, e.g:
Code:
select table1.*, table2.notes
from table1, table2
where table1.id = table2.itemno
and table2.username = 'x123';
Which works for user x123, but for user a123 it would only return the one row that they have an entry for. My question is how do I make it select all the rows in table1 for user a123 with Null as the notes field for any they do not have an entry for?
TIA.
C:\DOS:>
C:\DOS:>RUN
RUN DOS RUN!!