We help IT Professionals succeed at work.

Help with Group By clauses

TECH_NET
TECH_NET asked
on
235 Views
Last Modified: 2010-03-19
I have a sql statement as follows:

SELECT USER_REGISTRATION_ID,DEALS_NAME,VENDOR_NAME,PROCESS_DATE FROM NOTIFYDEALS_LOGISTICS_VIEW GROUP BY USER_REGISTRATION_ID

I wish to get the following output.

Generate a list that is grouped by user_registeration  and get the total count (based on the no of occurrance of the user_registration-id in the table), Also i wish to retrieve the remaider of the columns.

Comment
Watch Question

Author

Commented:
I first part was achieved by the following query
SELECT USER_REGISTRATION_ID,Sum(USER_REGISTRATION_ID) FROM NOTIFYDEALS_LOGISTICS_VIEW GROUP BY USER_REGISTRATION_ID
but how do i get the remainder of the column and still show the aggregrate
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I have 3 records and all the record show up but i do not see the count showing up with the right value. Since all the 3 records are for the same USER, (ie USER_REGISTRATION_ID =1)
the resultant should be 3 records showing the count column value (ie idcnt) as 3.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.