• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Complex Sql don't work in $this->db->query()

#1
[eluser]abmcr[/eluser]
I have try to use a complex query : this sql work fine into the SQL tab of phpadmin... and not into CI.

Code:
$sql="CREATE TEMPORARY TABLE tmptable
SELECT id FROM bacheca AS A ORDER BY id DESC LIMIT 30;
DELETE bacheca FROM bacheca WHERE id NOT in (SELECT * FROM tmptable)";
$this->db->query($sql);

The error is

Code:
Error Number: 1064

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 ';DELETE bacheca FROM bacheca WHERE id NOT in (SELECT * FROM tmptable)' at line 1

CREATE TEMPORARY TABLE tmptable SELECT id FROM bacheca AS A ORDER BY id DESC LIMIT 30;DELETE bacheca FROM bacheca WHERE id NOT in (SELECT * FROM tmptable)

Any suggestion? Thank you in advance.... ciao!


Messages In This Thread
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 07:00 AM
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 08:01 AM
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 09:19 AM
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 10:42 AM
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 11:35 AM
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 01:45 PM
Complex Sql don't work in $this->db->query() - by El Forum - 09-24-2008, 01:48 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.