Re: Comparing COUNTs from a self-join

From: Mark Davies (markdavies2003_at_msn.com)
Date: 05/26/04


Date: Wed, 26 May 2004 06:19:18 -0600

Ashish,

> I understand that you wanted to achieve Crosstab query result. This can be
> achieved by using temporary tables.
> What I did is create two table variables.
> Fill the two tables with the records based on one of the two criterias for
> eg. Where Mouse occurs less than 4 times in black and atleast once in
> white.

I had been considering that option as well, but I was hoping that there
might be a way to do it "directly" with one SQL statement, without having to
insert data into temporary tables. I'll be doing this via a web interface,
and it will take a second or so to DELETE the previous data in the two temp
tables, perform the two INSERTs, and then run a JOIN between the two temp
tables. I'd like to avoid that overhead and extra time, but if that's the
only way to do it, I guess there's no alternative. Anyway, thanks for your
reply.

Mark Davies