raj_2006
09-27-2006, 02:15 PM
Hi
this is a continuation from my previous thread...I wish to continue from that thread but i have marked that one with resolved....anyway
I have a product table where 4 records are there.
pid(product id) is the primary key,autoincremental and cid is the category id.
cid pid
20 1
20 2
20 3
20 4
In another table named special there are 3 records.But in this table there is no primary key.here is also the same pid as in product table.
pid discount
1 10
2 20
3 30
Now i want to show the all products either with discount or without discount
so it will be like this
pid discount
1 10
2 20
3 30
4 no discount //this text i can display.
Now I am writing this query
SELECT * from product LEFT JOIN special on product.pid = special.pid WHERE product.cid = $master_id;
4 rows are displaying but one pid is not showing
its looking like this
pid discount
1 10
2 20
3 30
no discount //this text i can display and here the pid 4 is missing
Can anyone please suggest me what should i do?
Thanks in advance for your co-operation
Raj
this is a continuation from my previous thread...I wish to continue from that thread but i have marked that one with resolved....anyway
I have a product table where 4 records are there.
pid(product id) is the primary key,autoincremental and cid is the category id.
cid pid
20 1
20 2
20 3
20 4
In another table named special there are 3 records.But in this table there is no primary key.here is also the same pid as in product table.
pid discount
1 10
2 20
3 30
Now i want to show the all products either with discount or without discount
so it will be like this
pid discount
1 10
2 20
3 30
4 no discount //this text i can display.
Now I am writing this query
SELECT * from product LEFT JOIN special on product.pid = special.pid WHERE product.cid = $master_id;
4 rows are displaying but one pid is not showing
its looking like this
pid discount
1 10
2 20
3 30
no discount //this text i can display and here the pid 4 is missing
Can anyone please suggest me what should i do?
Thanks in advance for your co-operation
Raj