September 9, 2008 at 3:18 pm
HI-
I NEED TO DO THE FOLLOWING RESULTS:
I need * from , the total number of records from that match [CERTAIN FIELD 1], and the total that match the [CERTAIN FIELD2] FOR EACH ROW RESULT.
(NOTICE THAT ALL QUERIES USE THE SAME TABLE)
IS THE BEST SOLUTION TO RUN THE THREE QUERIES INTO TEMP TABLES THEN JOIN THE THREE OR TO USE SOME SUB QUERIES?
HERE ARE THE THREE QUERIES THAT I NEED TO COMBINE SOMEHOW:
select top 25 * from (nolock)
where [CERTAIN FIELD 1] != '0'
order by id desc
select [CERTAIN FIELD 1], count(*) from (nolock)
where [CERTAIN FIELD 1] in (
select top 25 [CERTAIN FIELD 1] from (nolock)
where [CERTAIN FIELD 1] != '0'
order by id desc)
group by [CERTAIN FIELD 1]
select [CERTAIN FIELD2], count(*) from (nolock)
where [CERTAIN FIELD2] in (
select top 25 [CERTAIN FIELD2] from (nolock)
where [CERTAIN FIELD1] != '0'
order by id desc)
group by [CERTAIN FIELD2]
PLEASE SOMEONE HELP...THANKS . A.
September 9, 2008 at 4:02 pm
figured it out, thanks.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply