SQL Server Select Query usng Group By with ability to select all columns

I need a SQL Select Query that will not do duplicate matches against a second table.  I have two tables that are joined but table [Management Report Active List]. has duplicate Product Codes.   Group by statement would be perfect but I need to be able to show all columns from both tables so how can I use group by and still display all columns.,

SELECT *   (how can I list all columns and still use group by)
FROM [Management Report Active List]
INNER JOIN [Consolidated List] ON [Management Report Active List].[Product Code] = [Consolidated List].[Product_Code]
GROUP BY [Management Report Active List].[Product Code]
hojohappyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
What you're asking for doesn't make sense.  You can't group AND display everything at the same time.  The purpose of grouping is to aggregate.  If there are multiple matching entries in Consolidated List then you need to decide how you want to display the child rows.

Please provide sample output so we can understand better what you are trying to achieve.
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Give us a data mockup, both before and after, of what you're trying to pull off here.
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

PortletPaulfreelancerCommented:
"so how can I use group by and still display all columns.,"?

Sounds to me like you want ROW_NUMBER() :- not group by

BUT; like everyone before me, it's impossible for us to know the best solution without more information;

sample data (per table!) and expected results please
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skullnobrainsCommented:
you need to use an aggregate function on each of the fields of the consolidated list table.

if you don't care which row's information will be displayed, just use either min or max
0
awking00Commented:
hojohappy,
You need to help the experts help you. Sample input and output has been requested and, if you provide it, I will bet you can get a solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.