[RESOLVED] sql problem
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.
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.
Now i want to show the all products either with discount or without discount
so it will be like this
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
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
what do you mean by not displayed? how are you displaying it, just through the command line client or something else?
thanks for your reply...Its solved..
I just altered the sql in this way:
SELECT *,product .pid from product LEFT JOIN special on product.pid = special.pid WHERE product.cid = $master_id;
i guess this goes back to avoiding using * in queries.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)