syntax101 Posted January 12, 2008 Share Posted January 12, 2008 my problem is i want to display all data that has a "rejected", i have two tables orders and archivedeletedorders and they have all the same fields. ex. orders table name status <-fields henry pending squall rejected archivedeleteorders table name status <-fields philip pending john rejected result should be: name status squall rejected john rejected my code is: select * from orders,archivedeletedorders where orders.del_status = "Rejected" and archivedeletedorders.del_status = "Rejected" but the result will combine them like this: name status name status squall rejected john rejected can anybody help me with this Link to comment https://forums.phpfreaks.com/topic/85664-solved-help-with-two-tables/ Share on other sites More sharing options...
Barand Posted January 12, 2008 Share Posted January 12, 2008 You need a UNION, not a JOIN SELECT name, status FROM orders WHERE status = 'rejected' UNION SELECT name, status FROM archivedeletedorders WHERE status = 'rejected' Link to comment https://forums.phpfreaks.com/topic/85664-solved-help-with-two-tables/#findComment-437174 Share on other sites More sharing options...
syntax101 Posted January 12, 2008 Author Share Posted January 12, 2008 thanx a lot, i forgot to use UNION Link to comment https://forums.phpfreaks.com/topic/85664-solved-help-with-two-tables/#findComment-437192 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.