Saroj13
asked on
Get the count using sql query on sql server 2005
Please see the below query. please tell me how to get count using below uery.
thanks
thanks
(SELECT DISTINCT Title, Label, Date
FROM [fnGetTotalDocs]() As TotalDocs
AND not exists
(SELECT Title, Label, Date
FROM [ReadDocs] As ReadDocs
and TotalDocs.Title=ReadDocs.Title
)
order by Date
ASKER
This query is the complete one. I want to dispaly the #
I cannot believe this is the full query, at least not for sql 2005:
§ there is no WHERE (just AND alone is a syntax error)
§ no subquery alias (another syntax error)
§ the [] around Date as reserved keyword for column name is missing (might return wrong results)
anyhow:
>I want to dispaly the #
# of what? in regards to the rows returned, the total #?
or per "group" of Title?
or per "group" of Title + label?
please provide sample data with the matching output requested to clarify the request.
§ there is no WHERE (just AND alone is a syntax error)
§ no subquery alias (another syntax error)
§ the [] around Date as reserved keyword for column name is missing (might return wrong results)
anyhow:
>I want to dispaly the #
# of what? in regards to the rows returned, the total #?
or per "group" of Title?
or per "group" of Title + label?
please provide sample data with the matching output requested to clarify the request.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
here is the updated query
I am getting teh TotalDocs and Read Docs . Displaying those are not in ReadDocs.
I want the count.
I am getting teh TotalDocs and Read Docs . Displaying those are not in ReadDocs.
I want the count.
SELECT DISTINCT Title, Label, DateStamp
FROM [fnGetTotalDocs]() As TotalDocs
WHERE
Title != ''
AND not exists
(SELECT Title ,Label, UserID, DateTimeStamp
FROM [ReadDocs] As ReadDocs
where UserID='abc'
and TotalDocs.Title =ReadDocs.Title
)
order by DateStamp
apart from that, what should the end-result look like?