I have a field with entires like this:
0003123120090O
0003123120091N
0003123120092R
0003123120093R
0003123120094N
0003123120080O
0003123120080O
0003123120070O
0003123120070O
0003123120070O
0003123120070O
0003123120060O
I need to get a total count of all records for 2009, a count of all records with N as the last character for 2009 and a count for R as the last character for 2009
I can do so with 3 separte SELECT COUNT(*) queries, but I was wondering if there was a way to get all three counts in one query. I tried this and it didn't work
Code:
select fieldname
(select count(*) from tablename
where fieldname like '%2009%' As total),
(select count(*) from tablename
where fieldname like '%N%'
and fieldname like '%2009%' As NoLoads),
(select count(*) from tablename
where fieldname like '%R%'
and fieldname like '%2009%' As Revisions)
from tablename
Is this possible or do I just suck it up and do three separate queries?