如何在PHP中将两个查询作为子查询联接 [英] How can join two query as a sub query in php

查看:68
本文介绍了如何在PHP中将两个查询作为子查询联接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对子查询有问题,请问有人可以帮忙吗
我有两个查询,我想在子查询的帮助下只写一个查询
主要查询是

i have a problem with the sub query can any one help me please
i have two query and i want to write only one query with the help of sub query
main query is

SELECT Count(*) as total, UR.name,C.comment_assin FROM comment C INNER JOIN user_reg UR on C.comment_assin=UR.emp_id WHERE C.commentstatus NOT IN('0','3') group by comment_assin ORDER BY C.id DESC 



子查询在这里



sub query is here

SELECT Count(*) AS TOTAL , UR.name,C.comment_assin FROM comment C INNER JOIN user_reg UR  on C.comment_assin=UR.emp_id  WHERE  C.commentstatus ='3' group by C.comment_assin  ORDER BY C.id DESC


我想合并两个查询与子查询的帮助.


i want to merge both the query with the help of sub query. how can do it please help.

推荐答案

也许"UNION"将帮助您合并两个查询.请参阅以下示例: http://msdn.microsoft.com/de-de/library/ms180026.aspx [ ^ ]

问候
Maybe "UNION" will help you to merge the two queries. See examples at http://msdn.microsoft.com/de-de/library/ms180026.aspx[^]

Regards


这篇关于如何在PHP中将两个查询作为子查询联接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆