google-code-export / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

Wrong number of rows on select with union #262

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Launch the attached test

What is the expected output? What do you see instead?
I expect twice the number of rows in the test table, instead I get a little 
less rows.

What version of the product are you using? On what operating system, file
system, and virtual machine?
1.2.147, Java 1.6.0_22-b04

Do you know a workaround?
Add a column with a unique content in the selected columns.

How important/urgent is the problem for you?
Important, not urgent.

In your view, is this a defect or a feature request?
It is a defect

Original issue reported on code.google.com by opar...@gmail.com on 8 Dec 2010 at 12:39

Attachments:

GoogleCodeExporter commented 9 years ago
This is not a bug, all databases work like this. You have duplicate rows, and 
UNION will remove duplicates. Use UNION ALL if you don't want to remove 
duplicates.

To list duplicates, use:
select date_start, count(*) from test1 group by date_start having count(*) > 1

Original comment by thomas.t...@gmail.com on 8 Dec 2010 at 7:00