Jump to content

[SOLVED] Arg! Can I use LIKE with ; delimited ids while JOINING?


masteroleary

Recommended Posts

This is what I have so far. Im completely new to mysql. I need to get site.name with the data model_shoot.model_id

 

My tables include two columns:

model_shoot.model_id model_shoot.shoot_id

 

shoot_site.shoot_id shoot_site.site_id

 

site.id site.name

 

The second column ids are ; delimited (i.e. model_shoot.shoot_id = 1;4;5;7)

 

 

SELECT site.name
FROM site 
JOIN shoot_site ON shoot_site.site_id LIKE site.id  
JOIN model_shoot ON model_shoot.shoot_id LIKE shoot_site.shoot_id 
WHERE model_shoot.model_id = '6'

Link to comment
Share on other sites

So if i have this i would say 'SELECT site.name

FROM site

JOIN shoot_site ON shoot_site.site_id = site.id 

JOIN model_shoot ON model_shoot.shoot_id = shoot_site.shoot_id

WHERE model_shoot.model_id = 1' ?? and i should get two rows with names for site 1 & 2?

Table model_shoot
id   model_id   shoot_id
1    1               4
2    1               5
3    2               1

Table shoot_site
id   shoot_id   site_id
1    4              1
2    4              2
3    5              2

Link to comment
Share on other sites

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.