0

I need to find a records where the values of some field are different, it looks like IN, better to say FIND ALL WHERE field=1 OR field=2... OR field=9 And these OR can be a lot. Is it possible to make somethig with this in ORM on Kohana?

Victor Czechov
  • 237
  • 1
  • 6
  • 12

1 Answers1

0
ORM::factory('Model')->where('field1', '=', 'value')->or_where('field2', '=', 'value')...
Thorsten
  • 5,634
  • 6
  • 35
  • 33
  • 1
    maybe it must look like ``ORM::factory('Model')->where('field','IN',$arr)->find_all();`` but I don't know exactly, maybe it's a wrong example. Sure if ``$arr = ( 2, 3, 5, 8 );`` – Victor Czechov Sep 07 '12 at 19:32
  • Victor, please put your answer into it's own answer for proper credit. Your solution is the correct way to do this. – gspatel Sep 08 '12 at 04:41
  • Yes, I might misunderstood the question. If you simply want to query multiple values for ONE field, you are much better off with a `field IN (1,2,3)` query. – Thorsten Sep 08 '12 at 08:04