Hi,
In a mysql db I have a 'users' table and an 'items' table.
Users can enter items after having filled out a profile for themselves, or they can enter with only a name (no profile). What I want to do is list items with the names of the users that entered them while checking the users table to see if a profile exists for that user.
If a profile does exist, I'd link the users name to their profile.
the site is here, which might help clarify:
<!-- m --><a class="postlink" href="http://www.datablob.com">http://www.datablob.com</a><!-- m -->
I suspect that the problem I have could be solved with the Join syntax?
select USERS.NAME as USER1, ITEMS.NAME as USER2, ITEMS.ID, ITEMS.TITLE, ITEMS.DESC FROM ITEMS, USERS WHERE (ITEMS.ID > 0) and (USERS.NAME = ITEMS.NAME)
Obviously this limits the results to only items that have users with profiles attached. How can I make a SQL statement that returns all of the results while simply setting USER1 to "" or "name".
Thanks mucho,
Ben
In a mysql db I have a 'users' table and an 'items' table.
Users can enter items after having filled out a profile for themselves, or they can enter with only a name (no profile). What I want to do is list items with the names of the users that entered them while checking the users table to see if a profile exists for that user.
If a profile does exist, I'd link the users name to their profile.
the site is here, which might help clarify:
<!-- m --><a class="postlink" href="http://www.datablob.com">http://www.datablob.com</a><!-- m -->
I suspect that the problem I have could be solved with the Join syntax?
select USERS.NAME as USER1, ITEMS.NAME as USER2, ITEMS.ID, ITEMS.TITLE, ITEMS.DESC FROM ITEMS, USERS WHERE (ITEMS.ID > 0) and (USERS.NAME = ITEMS.NAME)
Obviously this limits the results to only items that have users with profiles attached. How can I make a SQL statement that returns all of the results while simply setting USER1 to "" or "name".
Thanks mucho,
Ben