Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z zapytaniem, You have an error in your SQL syntax
NetJaro
post
Post #1





Grupa: Zarejestrowani
Postów: 475
Pomógł: 0
Dołączył: 1.04.2005
Skąd: Warszawa

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


Witam, mam zapytanie:

  1. <?php
  2. $query = "SELECT member_details.jointed_date, member_details.f_name, member_details.l
    ogin, member_details.mem_id, member_details.email_id, count(member referrals.mem_id) as 'dupa' FROM `member_referrals`, member_details where member_details.mem_id=member_refe
    rrals.parent_id and member_details.joined_date >= '2005-09-30' in member_details.mem_id=member_referrals.mem_id group by member_referrals.pare
    nt_id order by 'dupa' DESC limit 0,30"
    ;
  3. ?>


Jednak pojawia się błąd:

Cytat
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 'member_details.mem_id=member_referrals.mem_id group by member_referrals.parent_' at line 3


Co tutaj jest źle?

Ten post edytował NetJaro 20.12.2005, 17:48:30
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
SongoQ
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

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


Cytat
Poprawna składnia to pole.tabela a nie jak u Ciebie tabela.pole

Pierwsze slysze. Gdzie o tym slyszales?

Zawsze tak bylo i zawsze tak bedzie schemat.tabela.pole w Twoim przypadku tabela.pole.

Cytat
FROM bardzo_dluga_nazwa_tabeli as t1

W stanardzie SQLa nie zaleca sie stosowaine AS przed nazwa tabeli, w niektorych bazach to poprostu niedziala.

Cytat
member_details.joined_date >= '2005-09-30' in member_details.mem_id=member_referrals.mem_id

NIe ma czegos takiego w SQLu

Jesli masz agregacje w to pozostale pola musisz wymienic w GROUP BY

p.s.
@kszychu Po tobie bym sie takiej odpowiedzi nie spodziewal. (IMG:http://forum.php.pl/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: 5.10.2025 - 08:43