Sqlstate[Hy000]: General Error

I’ve run into an error when executing a query. I get the following error when trying to run a select.

[sql]SQLSTATE[HY000]: General error

[/sql]

I’m using the following to run the query:


	

$command = Yii::app()->db->createCommand($sql);

$dataReader=$command->query();   

$avs=$dataReader->readAll();



The query consists of setting two User-Defined Variables, then a select statement. Like this:

[sql]

SET @start= null;

SET @end = null;

select … from …;

[/sql]

Am I using the right syntax for running that query? Any other thoughts?

EDIT: I know the query is ok. When I run it in my mysql application, it works fine.

found the answer:

http://www.yiiframework.com/forum/index.php/topic/37526-solved-cdbcommand-failed-to-execute-the-sql-statement-sqlstatehy000-general-error/