I am running a SQL command through VB and need to find a count of records returned in the query. I know this sounds simple, however the problem is that it ABSOLUTELY MUST be done in SQL. No recordcounts or while loops. Unfortunately, I can't get the count command to work efficiently here because the count command counts records in a group, not in a table, unless the table is one group. Let me explain what I need further.

Say I have a table with three columns Cnt, DataA, and DataB. I need a list containing DataA and DataB where Cnt contains the count of all records in the table. This means Cnt has the same value in every record.

Cnt DataA DataB
3 1 x
3 4 y
3 2 z

If the data is in the table Tbl, then the closest I have been able to come is

SELECT
(SELECT COUNT(*) FROM Tbl WHERE... GROUP BY...)
AS Cnt,
DataA,DataB FROM Tbl WHERE... GROUP BY...

This method does work, however I am also working under space restraints, so it would be nice if I don't have to repeat the select statement twice in the same SQL call.

Does anyone have any ideas?

Thanks in advance!