473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Re: Display duplicate rows

What happens when you add the column WQR_TDH_HEADER_ID to both SELECT and
GROUP BY? If you get rows you consider non-duplicate show as duplicate, then
most likely your grouping does not include all significant columns to
consider one row unique.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Jun 27 '08 #1
4 2894
I would like to group by fewer columns, but I get an error trying to
compile.
As an example, eleminating the SHIFT column from group by gives the
following error:

Msg 8120, Level 16, State 1, Procedure PWQR_Select_Teardown_15_Day_Summary,
Line 26

Column 'TWQRHISTEARDOWN_HEADER.WQR_TDH_SHIFT_X' is invalid in the select
list because it is not contained in either an aggregate function or the
GROUP BY clause.

"Plamen Ratchev" <Pl****@SQLStudio.comwrote in message
news:HZ******************************@speakeasy.ne t...
What happens when you add the column WQR_TDH_HEADER_ID to both SELECT and
GROUP BY? If you get rows you consider non-duplicate show as duplicate,
then most likely your grouping does not include all significant columns to
consider one row unique.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Jun 27 '08 #2
Actually I mean the opposite, you may need to add more columns to both
SELECT/GROUP BY to get correct results.

You do need to have the columns in the SELECT list as part of the GROUP BY
clause.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Jun 27 '08 #3
I am kind of new to this. Does each column in SELECT require a GROUP BY? I
am getting an error if I don't include all SELECT columns in GROUP BY
columns. I only need to group by around four columns, but need to display
all columns in SELECT.

Thanks for the help.

Charlie

"Plamen Ratchev" <Pl****@SQLStudio.comwrote in message
news:OM******************************@speakeasy.ne t...
Actually I mean the opposite, you may need to add more columns to both
SELECT/GROUP BY to get correct results.

You do need to have the columns in the SELECT list as part of the GROUP BY
clause.

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Jun 27 '08 #4
I actually already listed aggregate functions: "...only grouping columns,
aggregate functions, or constant expressions...".

Plamen Ratchev
http://www.SQLStudio.com

Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Asha | last post by:
greetings, does anyone have any idea how to delete duplicate rows in a dataset gracefully (the fast and easy way)
13
by: Ennio-Sr | last post by:
Hi all! After a very long struggle I finally succeded in transferring my old *.dbf file and the relating *.dbt (alias memo fields) to a pg table. For the time being I put the memo field in a...
7
by: Jon Maz | last post by:
Hi, I have a MySql problem I hope someone can help me with. I'm trying to run an update on a linking table, the update is running into a Primary Key constraint violation, and in my workaround...
5
by: Manish | last post by:
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone |...
0
by: B.N.Prabhu | last post by:
Hi, I have a DataTable with several rows. Its having 20 Columns. when i click the Insert button then i have to check the Database Rows. Whether these new rows are already available in the...
2
by: Rich | last post by:
Hello, I am just checking if there is a property or technique for displaying or retrieving from a dataTable the top 1 row(s) for rows containing duplicate keys (IDs). I have to pull data from a...
5
jamesd0142
by: jamesd0142 | last post by:
My manager and I where looking at some complex code to eliminate duplicate records in a database table. then it hit me how its done easily... so i thought i'd share it... In English:...
1
by: rfeio | last post by:
Hi! I have a table with several rows, some of which I need to duplicate. The fields of table1 are field1, field2, field3 and field4. Field1 is automatically incremented, field2 will serve as a...
4
by: ravir81 | last post by:
Hi, I am currently working on excel validation using Perl. I am new to Excel validation but not for Perl. I have a question regarding one of the validation. Could anyone please tell me how to get...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.