Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Zapytanie JOIN
r4ven
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 23.11.2005

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


Witam

Mam tabele
1 - 'events' i kolumny event_id, user_id, soundsupport_id, techsupport_id
2 - 'workers' i kolumny user_id, user_name, user_email

pobieram sobie jeden event z tabeli i mam problem z dopasowaniem ludzi z tabeli workers
bez problemu pobieram sobie pracownika ktory dodal event

SELECT * FROM events
INNER JOIN workers ON events.user_id = workers.user_id
WHERE event_id='1'

Czy da się w tym zapytaniu przyporządkować nazwę pracownika(user_name) dla kolumn soundsupport_id i techsupport_id

Pozdrawiam

Ten post edytował r4ven 17.03.2011, 15:09:32
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
dr_bonzo
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


SELECT * FROM events
INNER JOIN workers ON events.user_id = workers.user_id
INNER JOIN workers AS w2 ON events.soundsupport_id = w2.id
...itd
WHERE event_id='1'
Go to the top of the page
+Quote Post
san32
post
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 18.09.2010

Ostrzeżenie: (20%)
X----


SELECT [to co chesz] FROM events
left JOIN workers usign(events.user_id)

WHERE event_id='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: 25.08.2025 - 07:50