开发者

Combine multiple queries

开发者 https://www.devze.com 2023-02-10 03:22 出处:网络
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)?m

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

精彩评论

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