Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mysql] relacja miedzy tabelami
-Gość_ziomek-
post
Post #1





Goście







mam dwie tabele. jedna z ksiegami gosci a druga z urzytkownikami

tabela ksiegi zawiera m.in. pola: idksiegi, idusera
tabela users zaweiera m.in pola: idusera, email

i teraz chce jednym zapytaniem pobrac email z users na podstawie idksiegi z ksiegi
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
Vogel
post
Post #2





Grupa: Zarejestrowani
Postów: 402
Pomógł: 0
Dołączył: 20.01.2003

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


  1. SELECT ksiegi.idksiegi, users.email
  2. FROM users
  3. LEFT JOIN ksiegi ON ksiegi.idusera=users.idusera
Go to the top of the page
+Quote Post
-Guest-
post
Post #3





Goście







chyba zle wytlumaczylem

mam dane idksiegi. i chce pobrac email
Go to the top of the page
+Quote Post
-Guest-
post
Post #4





Goście







poradzilem sobie:
  1. SELECT users.email
  2. FROM ksiegi,
  3. users WHERE ksiegi.id_usera=users.idusera AND ksiegi.idksiegi=1
Go to the top of the page
+Quote Post

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: 22.08.2025 - 22:28