petenaylor Posted July 31, 2012 Share Posted July 31, 2012 Hi all I need to write a mySQL query that selects all from one table where there is not the instance in more than one field in another table. The query I have so far is: mysql_query (" SELECT * FROM text_positions where position not in (select logo_position from shop_basket ) ORDER BY position ASC ") or die (mysql_error()); Which works great, but the position could also be in the text_position on the shop_basket table. How can I add this into my query? There is 5 possible field I need to check in the shop_basket table. Many thanks Pete Quote Link to comment Share on other sites More sharing options...
Christian F. Posted August 1, 2012 Share Posted August 1, 2012 You might want to look into using JOINs for this one, and limit the result to rows where both the other table's position is NULL. Should give you exactly what you want. Quote Link to comment Share on other sites More sharing options...
Barand Posted August 1, 2012 Share Posted August 1, 2012 We haven't a clue about your table structures, so what do expect from us? 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.