DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: SQL urgent help

  1. #1
    Join Date
    May 2000
    Location
    fremont ca
    Posts
    182
    Hi!

    My want to count only those buyer who appear more then 1 (> 1)

    What should be my sql statment.

    select count(distinct(buyer)) from xxxx.

    This will not work because it counts buyer who appear once.
    (how can I ommit buyer who appear once)


  2. #2
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Code:
    SELECT
    	COUNT(*)
    FROM
    	(
    	SELECT 
    		BUYER
    	FROM
    		XXXX
    	GROUP BY
    		BUYER
    	HAVING
    		COUNT(*) > 1
    	)
    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

  3. #3
    Join Date
    May 2000
    Location
    fremont ca
    Posts
    182
    I can not do that because my query is very big and this is just one of the field.
    i.e.
    select
    td.time_dt Todate,
    ofr_grp_nm GroupName,
    ofr_grp_dt GroupDate,
    max(ofr_close_dt)CloseDate,
    count(distinct(it.item_sku)) ItemSKU,
    sum(ofr_list_qty) ListQty,
    sum(ofr_close_qty) CloseQty,
    count(ofr_win_oid) NoOfWins,
    sum(ofr_close_cost) CloseRev,
    from xxxx
    where condition


  4. #4
    Join Date
    Apr 2001
    Posts
    118
    Perhaps if you want an answer to your exact question you would actually post it first?

  5. #5
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Maybe if you followed your duplicate thread, you would have the answer by now.
    http://www.dbasupport.com/forums/sho...threadid=19771
    Jeff Hunter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width