2011-02-11 137 views
0

我想要做这样的事情:合并多个查询

set @col = 'test'; select @col; 

而在mysql_query PHP函数使用。我该怎么做,所以它应该返回'测试'(第二个查询的结果)?

回答

0

mysql_query不支持多个查询。您需要使用Mysqli功能。

0

您可以将两个变成一个像

select if (@col is null, @col:='test', @col); 
0
select a,b,c,d from table1 where a=2 

union all 

select a,b,c,d from table1 where a=3;