retreiving data from two tables
I am trying to retreive data from two tables. when I run it, it only shows the one file in documents, and not the other one in uploads.
Code:
Select *
from uploads, documents
WHERE uploads.user = '$userID' AND documents.user = '$userID'
ORDER BY uploads.title ASC, documents.title ASC
Since MySQL is a relational database you need to indicate that relationship such as
WHERE uploads.user = documents.user AND uploads.user = $userID
are the titles also identical ?
WHERE uploads.title = documents.title
Your SELECT statement may need to be more specific too.
What I have is two tables. one is general uploads (pictures, videos, etc.). the other one is of documents. i wanted to combine the two so that the user can see what they have.
Try this:
Code:
Select *
from uploads left join documents on (uploads.user = documents.user)
WHERE uploads.user = '$userID'
ORDER BY uploads.title ASC, documents.title ASC
My settings
Browser :: FireFox 1.5
Resolution :: 1152x864
Connection :: Cable Modem 2Mbs
i don't get anything then for this.
Provide everyone with your current structure and what you want to extract from them. Our mind reading skills haven't been upgraded for a while
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks