CodeIgniter Forums
help pls.... how to convert to ignited datatables? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: help pls.... how to convert to ignited datatables? (/showthread.php?tid=57905)



help pls.... how to convert to ignited datatables? - El Forum - 04-24-2013

[eluser]Unknown[/eluser]
Hey i'm writing a script at the moment and i need to write a query which will work like this

SELECT * FROM `table`
IF `table`.`field_1` = 'somthing'
LEFT JOIN `another_table`
ON `table`.`field_2` = `another_table`.`field_1`
ELSE IF `table`.`field_1` = 'somthing_else'
LEFT JOIN `another_table_2`
ON `table`.`field_2` = `another_table_2`.`field_1`
END IF
WHERE `table`.`field_3` = 'keyword'

I hope that makes sense. I've never used IF statements in mysql before and i can't find much documentation that helps.

Thanks


help pls.... how to convert to ignited datatables? - El Forum - 04-24-2013

[eluser]xtremer360[/eluser]
You should look into CASES for queries like that.