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 Quote 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' Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.