Jump to content

[SOLVED] probably a lot easier than i think -- please help


Recommended Posts

Table: Assets

{id, asset_name}

Table: Attributes

{id, option}

Table: Assets_Attributes

{asset_id, option_id}

 

Assets_Attributes might look like

1, 1

1, 2

2, 1

3, 1

4, 1

4, 2

4, 3

 

I get how to select asset_name where an option is found (ex: option_id 2 would yield asset_name for asset_id 1,4)

But how about if i want the ability to provide multiple option_id(s)?

(ex: option_id 1 would  yield asset_name for asset_id 1,2,3,4)

(ex: option_id 1,2 would yield asset_name for asset_id 1,4)

(ex: option_id 1,2,3 would yield asset_name for asset_id 4)

 

Thanks

I guess doing something like this is the easiest:

 

...

AND assets.id IN (2,4,5,6,7,8)

AND assets.id IN (1,3,5,6,7,8)

...

 

where each row is a delimited array of assets.id(s) found for each unique option.

this can be very easily scalable.

 

nm

 

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.