开发者

Combine multiple queries

I want to do something like this:

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

And use in the mysql_query PHP function. How can I do that so it should return 'test' (resul开发者_开发百科t of second query)?


mysql_query doesn't support multiple queries. You need to use the Mysqli functions for that.


select a,b,c,d from table1 where a=2

union all

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


you can combine two become one like

select if (@col is null, @col:='test', @col);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜