Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabulate 1

Status
Not open for further replies.
Sep 12, 2007
45
US

I am trying to create a query which will tabulate the following data:

Apt Number
101
203
402
501
504
202
105
1005
103
102
201
206
403
304
205
102
101
4066
3045
205
3001
205
503
5001
206
204

As..........
Apt. Numbers with | Totals
Apt. Numbers starting with number 1 | 7
Apt. Numbers starting with number 2 | 9
Apt. Numbers starting with number 3 | 3
Apt. Numbers starting with number 4 | 3
Apt. Numbers starting with number 5 | 4

I can do this for each criterion individually ............

select count(AptNmbr) as Totals
from Apartments
where AptNmbr like '1%';

But not in the tabulated form (created above manually) through a single query.


 
Got it!

select left(([Apt Number]),1) as 'Apt Number Starting with Number', count([Apt Number]) as GroupTotal
from Apartments
where [Apt Number] like '%'
group by left(([Apt Number]),1);

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top