Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mysql] Zagnieżdżanie zapytania
looimaster
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 26.01.2008

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


  1. mysql_query("create table f_parts_inner (
  2. id int(6) not null auto_increment primary key,
  3. childof int(6),
  4. name varchar(250),
  5. mode int(6)
  6. )");
  7.  
  8. mysql_query("create table f_topics (
  9. id int(6) not null auto_increment primary key,
  10. sender_id int(6),
  11. childof int(6),
  12. subject varchar(250),
  13. content text,
  14. data_send bigint(15),
  15. mp_ident varchar(50)
  16. )");
  17.  
  18. mysql_query("create table users (
  19. id int(9) not null auto_increment primary key,
  20. user_account int(8),
  21. ...
  22. )");
  23.  
  24. mysql_query("create table characters (
  25. id int(9) not null auto_increment primary key,
  26. chars_account int(8),
  27. char_name varchar(65),
  28. char_level int(6)
  29. )");


  1. mysql_query("select f_topics.id, characters.char_name, f_parts_inner.name, f_topics.subject, f_topics.data_send from f_topics, characters, f_parts_inner, users where f_topics.sender_id=users.id and users.user_account=characters.chars_account and (characters.id=(select characters.id from characters order by characters.char_level desc LIMIT 1 )) and f_parts_inner.id=f_topics.childof order by f_topics.data_send desc LIMIT 35 ");


Chcę pobrać char_name gdzie sender_id z tabeli f_topics to id z tabeli users gdzie user_account z tej samej tabeli users to numer konta w tabeli characters gdzie chce z tej tabeli characters jak już wyciągnąłem user_account, chce wybrać z tabeli characters char_name, która ma największą wartość w char_level i chars_account to accountnumber tego konta.
Problem w tym że zapytanie nie zwraca żadnego wyniku, a dane są odpowiednie w tych tabelach. Prawdopodobnie błąd jest w zagnieżdżeniu zapytania, bo wątpię żeby reszta była niepoprawna.
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: 23.12.2025 - 18:56