Jump to content

Select from two tables


abdelelbouhy

Recommended Posts

Hi guys,

i have two tables products and deleted_products i want to select products_id from the two tables where the field suspend = 1 but there's no relationship between the tables in other words i want all the products_id from the tables where suspend = 1 but the products_id in table one doesn't match produtcs_id in table 2 the only relationship i can find is the suspend in both tables is 1

 

 

my query string is like that

 

select p.products_id as PID, dp.products_id AS PDID FROM products p, deleted_products dp WHERE p.suspend = dp.suspend and p.suspend = 1

 

it return zero result but the two tables have products with suspend = 1

 

thanx

Edited by abdelelbouhy
Link to comment
Share on other sites

No relationship (between your tables) = no join with sql. However, you can select both tables with two different queries and combine their results with PHP.

Edited by niche
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...