Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL]Ułożenie zapytania
evolucja
post
Post #1





Grupa: Zarejestrowani
Postów: 362
Pomógł: 27
Dołączył: 14.09.2009

Ostrzeżenie: (0%)
-----


Obecnie mam tak:
  1. SELECT * FROM `types` WHERE `userid` = ".$obstawianie_wyniki['id']." ORDER BY `date` ASC

Jednak `date` to data dodania wpisu, a nie meczu. A chciałbym aby sortowało się wg. daty meczu.

Próbowałem tak:
  1. SELECT * FROM `types` WHERE `userid` = 17 ORDER BY (SELECT `date` FROM `matches` WHERE `id` = matchid) ASC


Tabela: matches
id date ateam bteam aresult bresult agroup bgroup type

Tabela: types
id userid matchid atype btype date points
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
lobopol
post
Post #2





Grupa: Zarejestrowani
Postów: 1 729
Pomógł: 346
Dołączył: 4.04.2009

Ostrzeżenie: (0%)
-----


  1. SELECT * FROM 'types' INNER JOIN 'matches' ON 'types.matchid' = 'matches.id' WHERE 'types.userid' = 17 ORDER BY `matches.date` ASC


Ten post edytował lobopol 13.06.2010, 16:57:10
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 07:40