What I want to do is get the data from two different tables (table1 and table2) where row1 = 'test' in both of the tables
3 Answers
You'll want to use an INNER JOIN here - something along these lines (can't tell you for sure since you didn't give the structure of your tables)...
SELECT * FROM thread t
INNER JOIN post_display pd ON pd.threadid = t.threadid
WHERE t.threadid = 2
ORDER BY t.threadid DESC
Note: SELECT * can be very bad if you're selecting a bunch of fields you're never going to need. Once you have the query working, narrow down your select to the specific fields you're looking to work with.
More info on JOIN syntax for MySQL is available here: http://dev.mysql.com/doc/refman/5.1/en/join.html
2 Comments
I'm not quite sure what you're asking, but if you want to fetch columns from multiple tables at once (and it sounds like you're saying rows when you mean columns) you probably want a JOIN, which is an SQL feature