![]() |
![]() ![]() |
![]() |
![]() ![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 27 Pomógł: 0 Dołączył: 8.08.2003 Skąd: Częstochowa Ostrzeżenie: (0%) ![]() ![]() |
Probuje pobrac rekord o najmniejszym czasie z danej tabeli, niestety dostaje złe wyniki:(
TABELA course id id_line 1 1 3 1 2 2 TABELA calendar id_course date id_schedule 1 2008-09-11 1 2 2008-09-11 2 3 2008-09-11 3 TABELA schedule id id_stop time 1 1 09:40:00 2 1 11:00:00 3 1 08:00:00
Po wykonaniu tego zapytania dostaje taki wynik: min id 08:00:00 1 <- (ID dla tego rekordu powinno wynosic 3) 11:00:00 2 Po wielu godzinach prób znalazłem rozwiązanie. Z pomocą jak zwykle przyszedł manual MySQL. Poniższy tekst tłumaczy czemu MySQL zwracał mi wyniki: If the columns you omit from the GROUP BY part are not constant in the group. The server is free to return any value from the group, so the results are indeterminate unless all values are the same. Problem rozwiązałem po analizie tych przykładów: The Rows Holding the Group-wise Maximum of a Certain Field Rozwiązanie:
Ten post edytował skubekk 15.09.2008, 11:19:46 |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 19.07.2025 - 09:30 |