I have 3 mysql tables
dest
users
teachers
The dest table has the following columns
ID
USERID
UTYPE
USERMSG
ENTRYDATE
ID is an auto increment
USERID is a non unique column of auto increment ID's from users and teachers
UTYPE is a set "user", "teacher" and is the only thing that separates the entries since USERID is not unique.
This is my current query
SELECT
dest.ID,
dest.USERID,
dest.UTYPE,
dest.USERMSG,
dest.ENTRYDATE ,
if(jobbr.UTYPE = 'user', users.LOGIN, teachers.LOGIN) AS LOGIN
FROM
dest, users, teachers
WHERE
((dest.USERID = users.ID) AND (dest.UTYPE = 'user'))
OR
((dest.USERID = teachers.ID) AND (dest.UTYPE = 'teacher'))
ORDER BY
dest.ENTRYDATE
DESC LIMIT 0,30
And it brings up
ID USERID UTYPE USERMSG LOGIN
73 24 teacher This is an teacher test groone
73 24 teacher This is an teacher test groone
72 24 teacher test groone
72 24 teacher test groone
72 24 teacher test groone
71 73 user Trying to add teacher options now groone
56 73 user I have the recent tab working, not sure how becaus... groone
55 76 user howdy everyone! 2008-04-22 23:54:29 test
49 73 user cookies seem to work well now back and forth to th... groone
44 73 user Going to be adding teachers now. They will be a ... groone
39 75 user Curabitur tellus. Phasellus tellus turpis, iaculis... grump
38 75 user Donec a ante. Donec neque purus, adipiscing id, el... grump
When it should only bring up:
ID USERID UTYPE USERMSG LOGIN
73 24 teacher This is an teacher test groone
72 24 teacher test groone
71 73 user Trying to add teacher options now groone
56 73 user I have the recent tab working, not sure how becaus... groone
55 76 user howdy everyone! test
49 73 user cookies seem to work well now back and forth to th... groone
44 73 user Going to be adding teachers now. They will be a ... groone
39 75 user Curabitur tellus. Phasellus tellus turpis, iaculis... grump
38 75 user Donec a ante. Donec neque purus, adipiscing id, el... grump
As you can see, when it brings up teacher, it replicates the same number of records that are within user. I took out the entry columns so results would show on one line