![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 10 Pomógł: 0 Dołączył: 21.11.2009 Ostrzeżenie: (0%) ![]() ![]() |
Witam!
Mam problem. Otóż posiadam dwie tabele: 1. events: event_id | name | description 2. translate: id (auto increment) | id_pl | id_tlum | id_lang Skrypt php działa w ten sposób, że wyciąga dane z tabeli events, porównuje je z danymi z tabeli translate i wyświetla tylko nazwę i opis elementów z wybranego języka. Przykładowo w tabeli events mamy wartości: 14 | koncert1 | opiskoncertu1 24 | koncert1_en | opiskoncertu1_en 25 | koncert2 | opiskoncertu2 W tabeli translate: 1 | 14 | 24 | en Próbowałem różnych zapytań. Wyświetlenie koncertów, które mają tłumaczenia to raczej żaden problem. SELECT * FROM $events_table, $trans_table AS t WHERE event_id = t.id_tlum AND t.id_lang = en GROUP BY event_id GROUP BY dodałem, ponieważ sql wyświetlał wyniki podwójnie. Jak natomiast wyciągnąć tylko koncerty, które NIE MAJĄ tłumaczenia? Próbowałem wykorzystać JOIN ON, LEFT JOIN, RIGHT JOIN... Wszystko na nic. SELECT * FROM $events_table, $trans_table AS t WHERE event_id <> t.id_tlum AND event_id <> t.id_pl GROUP BY event_id SELECT * FROM $events_table, $trans_table AS t WHERE event_id != t.id_tlum AND event_id != t.id_pl GROUP BY event_id Itp. zapytania... Jak to rozwiązać? |
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 01:01 |