Welcome Guest, Not a member yet? Register   Sign In
Active record, mssql isnull how do you do it?
#1

[eluser]0plus1[/eluser]
What is the correct way to make several queries like:

Code:
SELECT ISNULL(SELECT name FROM table2 WHERE id='x', 'codeigniter' ) AS name FROM table

in Active record?
#2

[eluser]David Johansson[/eluser]
Active record isn't very good at handeling nested queries, but you could probably do something like:
Code:
$this->db->select('ISNULL(SELECT name FROM table2 WHERE id=`x`, `codeigniter` ) AS name', FALSE)->get('table');
But other than that there is no special way of making it...
#3

[eluser]kgill[/eluser]
Why bother with AR if you're going to be using DB specific functions? Just use db->query and spare yourself the headache.




Theme © iAndrew 2016 - Forum software by © MyBB