Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [SQL] pobieranie danych, Pobranie danych z tabeli user.
qbsterr
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 14.07.2010

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


Witam.

Nie radze sobie z takim zapytaniem.

Tabela1.
ID
CratedBy
CratedWhen
....
CompleatedBy
CompleatedWhen ....

Tabela2.
ID_user
Imie
Nazwisko
....


Potrzebuje wybrac w jednym select imie i nazwisko kto utworzyl i kto zakonczyl dany rekord i czesto sa to dwie rozne osoby.
Przychodzi mi do glowy to:

sql = select Tabela2.Imie,Tabela2.Nazwisko,Tabela1.CratedBy.Tabela1.CompleatedWhen from Tabela1,Tabela2 where Tabela1.CratedBy=Tabela2.ID_user and Tabela1.CompleatedBy=Tabela2.ID_user;

ale zwraca mi null

Dzieki za pomoc.

Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




select ... from tabela 1
left join tabela2 as u1
left join tabela 2 as u2

i już (IMG:style_emoticons/default/smile.gif)
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: 23.08.2025 - 05:26