5 pts.
 SQL-Using count and inner join in a single query
Hi Trying to retrive a report from the DataBase using left join on two tables. To get the count of resultant table, I'm using count. But the output shows error. If I comment count statement then the query executes successfully. I feel there is some error in the syntax of the count that I'm using. Please give me the exact syntax for both count as well as inner join. Thanks in advance.

Software/Hardware used:
MS SQL 2005
ASKED: July 27, 2010  11:13 AM
UPDATED: July 27, 2010  4:04 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The general syntax is:

SELECT <some_columns>, COUNT(*)
FROM table1 t1 JOIN table2 t2
ON t1.columnX = t2.columnX
WHERE …
GROUP BY <some_columns>

Why don’t you post your query, so we can tell you where your error is ?

 63,535 pts.