开发者

joining two queries one containg simple select and one containing a function?

i have two queries- one containing simple select statement and the other one calls a finction.

example of both are --

select xx.a,xx.b,xx.c,aa.d,aa.e,aa.f from xyz_table as xx,abc_table as aa where xx.a=aa.d and xx.id='$id(dynamic id)'

other one is--

select function_na开发者_如何学JAVAme($id);   // same $id value as above one

Now in both the statements $id entered is same. Now how can i merge these two queries into one single query??


SELECT  xx.a, xx.b, xx.c, aa.d, aa.e, aa.f, function_name('$id(dynamic id)')
FROM    xyz_table AS xx
JOIN    abc_table AS aa
ON      aa.d = xx.a
WHERE   xx.id = '$id(dynamic id)'

Note that the function value will be returned along with each record (and it will be invoked that many times unless it's defined as DETERMINISTIC).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜