sql - Returning a result from a query, then a record count of that specific result -
the title confusing, basically, have created search feature allows users enter search terms. if entered 'e' return answers such "leeds, manchester, liverpool, doncaster" etc. basically, want checks each of towns/cities 1 one, checks how many bands registered towns/cities, , display say:
** "leeds - 5 records found"**
it easy if output multiple queries @ once, however, can't. if knows way around grateful.
are talking this?
select town, count(*) num blah = blah group town
this should give results set like:
town num ---- ---- leeds 2 liverpool 3
when use aggregate functions max
, count
, min
, group by
clause, aggregation applies group, in case, town.
Comments
Post a Comment