![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 77 Pomógł: 0 Dołączył: 30.03.2012 Ostrzeżenie: (0%) ![]() ![]() |
Witam
Pomoże mi ktoś z zapytaniem sql Mam w bazie danych 2 tabelki users i store o następującej strukturze users id_users autoincrement primary key name lastname password oraz store imageid autoincrement primary key id_users filename folder DO pobierania danych z obu tabelek używam LEFT OUTER JOIN i to się sprawdza. Problem jest taki że w tabelce store oczywiście może być kilka rekordów z takim samym id_users, jak wówczas pobrać dane w taki sposób aby wyświetlić wszystkie rekordy a jeśli jest kilka rekordów z takim samym id_users w tabelce store zawsze wyświetlić ten ostatnio zapisany w tabelce store z góry dzięki za pomoc właściwie to sobie już poradziłem, zapytanie działa oceńcie je $getdata = mysql_query ("SELECT DISTINCT users.id_users,users.name,users.lastname,users.email, store.imageid,store.id_users, store.filename,store.folder FROM users LEFT OUTER JOIN store ON users.id_users=store.id_users GROUP BY users.id_users DESC,store.imageid DESC HAVING store.id_users is null || store.imageid=(SELECT max( imageid ) FROM store)") or die (mysql_query()); |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 8 068 Pomógł: 1414 Dołączył: 26.10.2005 Ostrzeżenie: (0%) ![]() ![]() |
A słyszałeś o BBCODE ?
|
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 24.07.2025 - 15:34 |