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
evolucja
post
Post #2





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

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


You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''types' INNER JOIN 'matches' ON 'types.matchid' = 'matches.id' WHERE 'types.user' at line 1

(IMG:style_emoticons/default/sad.gif)
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: 2.10.2025 - 20:17