Re:Re: how to avoid scan the same table multi times?

2012-01-13 Thread 王锋
SELECT type , count(*) , count(DISTINCT u) , count(CASE WHEN plat=1 THEN u ELSE NULL) , count(DISTINCT CASE WHEN plat=1 THEN u ELSE NULL) , count(CASE WHEN (type=2 OR type=6) THEN u ELSE NULL) , count(DISTINCT CASE WHEN (type=2 OR type=6) THEN u ELSE NULL) FROM t WHERE dt in

Re: how to avoid scan the same table multi times?

2012-01-13 Thread Mark Grover
Xiaobin, I would assume that's what Martin meant. You can always add dashes to make it more readable:-) Mark Grover, Business Intelligence Analyst OANDA Corporation www: oanda.com www: fxtrade.com e: mgro...@oanda.com "Best Trading Platform" - World Finance's Forex Awards 2009. "The One to Watc

Re: how to avoid scan the same table multi times?

2012-01-13 Thread Xiaobin She
hi, I use the multiple inserts method, and I write an sql like this: from td INSERT OVERWRITE DIRECTORY '/tmp/total.out' select count(v1) INSERT OVERWRITE DIRECTORY '/tmp/totaldistinct.out' select count(distinct v1) INSERT OVERWRITE DIRECTORY '/tmp/distinctuin.out' select distinct v1 INSERT O