Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/77976-complicated-join-query/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.