art15 Posted April 9, 2008 Share Posted April 9, 2008 Hi all, I am trying to display the result from table excluding a single result where piD='donotshow'. the query I have is as follows; $sSQL = "SELECT DISTINCT products.pID NOT IN(products.pID='donotshow') ,pName,pDisplay,pSell,pInStock,rootSection,pStockByOpts " . $sSQL; the query doesnt give any error, however it does not show the pID's at all. Please help. thanks Quote Link to comment Share on other sites More sharing options...
art15 Posted April 9, 2008 Author Share Posted April 9, 2008 Hi Guys Please reply. I have the same thing working on another page where the query is "select pID from products where pID not in ('donotshow' ) "; thanks Quote Link to comment Share on other sites More sharing options...
aschk Posted April 10, 2008 Share Posted April 10, 2008 What does your full query string look like (without the . concats, i.e. echo it)? And, why are you using DISTINCT as you appear to be getting all your information from the products table? And why is your NOT IN part of the SELECT clause? It's a WHERE clause... Also DON'T use NOT IN as I suspect it's less efficient than using "WHERE products.pID != 'donotshow' "... Quote Link to comment 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.