Welcome Guest, Not a member yet? Register   Sign In
IF statement in an MySQL query
#7

[eluser]Musaddiq Khan[/eluser]
This is my query.
Code:
$this->db->select("item.*,IF( item.Is_group = '1',  .65 ,  .75 ) AS margin, parent_cat.Name as ParentCategory

when I run it gives the following error.

Quote:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '65`, `.`75` ) AS margin, `parent_cat`.`Name` as ParentCategory, `sub_cat`.`Name`' at line 1

SELECT DISTINCT `item`.*, IF( item.Is_group = '1', `.`65`, `.`75` ) AS margin,

Any way to use these values not the table fields


Messages In This Thread
IF statement in an MySQL query - by El Forum - 11-05-2009, 02:08 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 02:31 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:01 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:06 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:09 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:17 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 02:40 AM
IF statement in an MySQL query - by El Forum - 01-21-2014, 10:41 AM
IF statement in an MySQL query - by El Forum - 01-21-2014, 12:44 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 12:51 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:00 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:08 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB