Visual Basic SQL Count Query
Posted on 2004-03-31
Hi, I am trying to get the following information, using an Access Database:
sql = "SELECT A.1, A.2, A.3 FROM A"
But I also want to get a Count from B Where A.1 = B.1
If I try this:
sql = "SELECT A.1, A.2, A.3, count(B.2) As Number FROM A,B WHERE A.1 = B.1"
I am trying to get a result of all A.1, A.2, A.3 and a count of B.2 where A.1 = B.1
The error I get is:
“you tried to execute a query that does not include the specified expression ‘userName’ as part of an aggregate function"
Any help would be great!