mysql joins maybe..?
Posted: Thu Dec 10, 2009 2:15 pm
I have two tables:
The first table has a bunch of ID's and descriptions
The second table has values that match the first tables ID. This also has a user name to each value.
I want to display all of the values in table one, and only display the user name when table2 ID = table 1 ID and username equals a certain variable...
For example I want the output to look like...
Table 1 ID | Table 1 Description | Table 2 User | Table 2 ID
1 Page 1 user1 1
2 Page 2
3 Page 3 user1 3
4 Page 4
5 Page 5 user1 5
6 Page 6
7 Page 7
8 Page 8 user1 8
The first table has a bunch of ID's and descriptions
The second table has values that match the first tables ID. This also has a user name to each value.
I want to display all of the values in table one, and only display the user name when table2 ID = table 1 ID and username equals a certain variable...
For example I want the output to look like...
Table 1 ID | Table 1 Description | Table 2 User | Table 2 ID
1 Page 1 user1 1
2 Page 2
3 Page 3 user1 3
4 Page 4
5 Page 5 user1 5
6 Page 6
7 Page 7
8 Page 8 user1 8