Help with a SQL statement

  • Thread starter Thread starter Brendan Reynolds \(MVP\)
  • Start date Start date
B

Brendan Reynolds \(MVP\)

SELECT ProgramName, Count(WorkStationID) AS Workstations FROM YourTable
GROUP BY ProgramName
 
Hello,

I have a table with a list of different programs, and the clients that they
are installed on.

So the conents might be something like this:



Prog1, 34
Prog2, 34
Prog3, 34
Prog1, 35
Prog1, 37
Prog2, 37

The first column is the program name and the second is an ID of the
workstation.

How can I create a query that displays something like this:

Prog1 3
prog2 2
prog3 1

Cheers
CQMMAN
 
CQMMAN said:
Hello,

I have a table with a list of different programs, and the clients that they
are installed on.

So the conents might be something like this:



Prog1, 34
Prog2, 34
Prog3, 34
Prog1, 35
Prog1, 37
Prog2, 37

The first column is the program name and the second is an ID of the
workstation.

How can I create a query that displays something like this:

Prog1 3
prog2 2
prog3 1

Cheers
CQMMAN

Actually, I probably don't need a SQL statement so help on a standard Access
query would be great as well!

Cheers
 
A standard Access query *is* a SQL statement. To see what I mean, open any
query in design view, then choose 'SQL View' from the 'View' menu.

Take the SQL statement I posted, change the field and table names to your
real field and table names, and copy it to the clipboard. Create a new query
in design view (close the dialog without adding any tables) switch to SQL
View, paste in the SQL Statement, then switch back to Design view.

SQL View and Design view are just two different ways in which Access can
display the same query (with a few exceptions, such as union queries, which
can only be displayed in SQL View).
 
Back
Top