Tanner8
11-14-2011, 04:28 AM
Hey, I am trying to put together a MySQL Query to basically return one record when two different fields in two separate records match.
I have fields PostID (Primary Key), ThreadID, and Type in my database. I am trying to retrieve the last 5 records. Most of the time a simple query will do, but it needs to work with the constraint of if Type equals one of the other record's PostID, give me just the latest record.
I was trying to use MINUS to get a full result set, then remove all of the elements with with the Type being PostID, however I couldn't get it right because I couldn't compare the end result of one to the other.
Can anyone give me a hand?
Thanks
I have fields PostID (Primary Key), ThreadID, and Type in my database. I am trying to retrieve the last 5 records. Most of the time a simple query will do, but it needs to work with the constraint of if Type equals one of the other record's PostID, give me just the latest record.
I was trying to use MINUS to get a full result set, then remove all of the elements with with the Type being PostID, however I couldn't get it right because I couldn't compare the end result of one to the other.
Can anyone give me a hand?
Thanks