0

Lets say we have some values in a table like below with id vaues: 1 = animal, 2=carnivorous, 3=herbivorous

animals

name----------propertyId

cat ----------------1
dog ---------------1
rabbit--------------1

cat-----------------2
dog----------------2
rabbit--------------3

how can i select propertyId of values like:

cat&dog&rabbit ---> 1 (animal)

cat&dog ---> 2 (carnivorous)

Edit: Rabbit. Thanks Vland :)

hibbault
  • 37
  • 5
  • if rabbit is = 2 (carnivorous), why shouldn't it be selected? – Vland Mar 06 '14 at 19:09
  • @Vland, some rabbits are carnivorous ;) http://www.youtube.com/watch?v=XcxKIJTb3Hg – Thomas Levesque Mar 06 '14 at 19:19
  • @ibrahimyilmaz, could you please clarify your question? Are you trying to get the properties that are common to a group of animals? or just group the animals by property? – Thomas Levesque Mar 06 '14 at 19:21
  • Actually i have a list of selectlist items and i want to find the group id of selected items. I don't know there will be how many selectlists or options. – hibbault Mar 06 '14 at 19:23

1 Answers1

0

It turns out that i was looking for intersection of multiple lists like here. First i am getting all propertyId's of a property and then the others, finally intersection. This is the only solution which works for now.

Community
  • 1
  • 1
hibbault
  • 37
  • 5