Click here to Skip to main content
15,909,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

PHP
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
PHP
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.
Posted
Updated 3-Jul-12 18:11pm
v3

1 solution

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

Regards
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900