MySQL Forums
Forum List  »  German

zwei SELECT mit UNION ergibt unterschiedliches ResultSet
Posted by: Piero Faieta
Date: July 01, 2014 07:54AM

Hallo zusammen

Nach dem Upgrate von mySql 5.5.20 auf 5.6.16 gibt es Probleme mit einem SQL.
Ich habe die Teile mal extrahiert, so dass das SQL überall ausgeführt werden kann. Es sind zwei identische Selects mit einem UNION verknüpft.
Am Schluss des Posts seht Ihr das ResultSet. Die letzten 4 Rows müssten gleich wie die ersten Vier sein.

Besten Dank für Eure Hilfe.
Piero


select slice, timeslice from (
select str_to_date(201406290600, "%Y%m%d %H%i") + interval number * 60 minute as slice, time(str_to_date(201406290600, "%Y%m%d %H%i") + interval number * 60 minute) as timeslice from (
select number from
(select @num := @num + 1 as number from
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t0,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t1,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t2,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t3,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t4,
(select @num := -1) as t_init) as numbers
limit 4) as intervalNumber ) as slices
union all
select slice, timeslice from (
select str_to_date(201406290600, "%Y%m%d %H%i") + interval number * 60 minute as slice, time(str_to_date(201406290600, "%Y%m%d %H%i") + interval number * 60 minute) as timeslice from (
select number from
(select @num := @num + 1 as number from
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t0,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t1,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t2,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t3,
(select 0 union all select 1 union all select 2 union all
select 3 union all select 4 union all select 5 union all
select 6 union all select 7 union all select 8 union all select 9) as t4,
(select @num := -1) as t_init) as numbers
limit 4) as intervalNumber ) as slices


ResultSet:

slice timeslice
2014-06-29 06:00:00 06:00:00
2014-06-29 07:00:00 07:00:00
2014-06-29 08:00:00 08:00:00
2014-06-29 09:00:00 09:00:00
2025-11-24 22:00:00 22:00:00 <- NOK
2025-11-24 23:00:00 23:00:00 <- NOK
2025-11-25 00:00:00 00:00:00 <- NOK
2025-11-25 01:00:00 01:00:00 <- NOK

Options: ReplyQuote


Subject
Views
Written By
Posted
zwei SELECT mit UNION ergibt unterschiedliches ResultSet
1281
July 01, 2014 07:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.