Jump to content

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


bcoffin

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.