iceblox Posted November 19, 2007 Share Posted November 19, 2007 Hi Guys, I know what im trying to do is possbile just not sure how! This is what i have already but its just to start $query = "SELECT m2.ModelID FROM models m1 INNER JOIN deals m2 ON m1.modid=m2.ModelID WHERE m1.modid='$modid'"; Basically i have a table called 'deals' with my mobile phone deals and my mobile phones are stored in 'models'. On this particular page the ModelID from the models table is in the URL as a variable. What id like to do is if the deals table has no deals in it based on the ModelID then dont show any deals if it does then show. Any help would be appreciated Phil Quote Link to comment https://forums.phpfreaks.com/topic/77976-complicated-join-query/ Share on other sites More sharing options...
centerwork Posted November 19, 2007 Share Posted November 19, 2007 what is the m2? Quote Link to comment https://forums.phpfreaks.com/topic/77976-complicated-join-query/#findComment-394681 Share on other sites More sharing options...
iceblox Posted November 19, 2007 Author Share Posted November 19, 2007 Im not sure thats how i was shown to do a table join?... Quote Link to comment https://forums.phpfreaks.com/topic/77976-complicated-join-query/#findComment-394686 Share on other sites More sharing options...
nuxy Posted November 19, 2007 Share Posted November 19, 2007 I don't quite get what you want to do. Do you want to select data/information in the 'models' table based on the id of the row in the 'deals' table? I would suggest having two separate queries for this, because currently, you have an inner join that is selecting a column from only one table, which to me, seems pointless. Quote Link to comment https://forums.phpfreaks.com/topic/77976-complicated-join-query/#findComment-394704 Share on other sites More sharing options...
iceblox Posted November 19, 2007 Author Share Posted November 19, 2007 two queries? ;o) ok ill look into this Quote Link to comment https://forums.phpfreaks.com/topic/77976-complicated-join-query/#findComment-394713 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.