advanced sql query with grouping requests |
[eluser]endo[/eluser]
Hello, everyone! How to construct next query with AR? SELECT * FROM (`realty_objects`) WHERE (`district` = 'Manhatten' OR `district` = 'Brooklyn') AND `size` >= '30' AND `size` <= '40'
[eluser]danmontgomery[/eluser]
Code: $this->db->where('(district = "Manhatten" OR district = "Brooklyn")')
[eluser]jmadsen[/eluser]
or: Code: $sql = 'SELECT * Since you've already written your sql :-)
[eluser]Nick_MyShuitings[/eluser]
There was also a mod of AR floating around a while ago... I'll try and find it. Basically added to methods you could use for chaining, open_group and close_group, which really didn't do anything else other then add an open and closing parenthesis. Allowed for using the AR syntax to write these complex type queries.
[eluser]Nick_MyShuitings[/eluser]
This was the third request for this today... so here you go: http://ellislab.com/forums/viewthread/177531/ |
Welcome Guest, Not a member yet? Register Sign In |