![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This little request is working OK. The idea is to get a percentage of the selected records based only on the number of records per group divided by the number of selected records. (i.e. NOT divided by the total number of records in the table.) ---------------------------- SELECT locality, count(*) as ctr, count(*) * 100.00 /(SELECT count(*) from pat where locality like 'Pari%') as percent FROM Clients WHERE locality like 'Pari%' GROUP BY locality ORDER BY percent desc ---------------------------- But ... Is there another way of doing it that eliminates using of the where locality like 'Pari%' clause, twice ? |
![]() |
| Thread Tools | |
| Display Modes | |
| |