Autor Zpráva
XKrik
Profil
Zdravim,
mam příkaz
SELECT * FROM shoutbox left JOIN users ON shoutbox.user_id = users.user_id WHERE shoutbox.ban =0 ORDER BY shoutbox.date DESC LIMIT 25

A potřeboval bych, aby se vystup username určil podle této podmínky
if(shoutbox.user_id=0,shoutbox.username,users.username) AS username

Nevíte, jak na to?
joe
Profil
A takhle to nejde?

SELECT shoutbox.*, if(shoutbox.user_id=0,shoutbox.username,users.username) AS username FROM shoutbox left JOIN users ON shoutbox.user_id = users.user_id WHERE shoutbox.ban =0 ORDER BY shoutbox.date DESC LIMIT 25
XKrik
Profil
Funguje, diky.
Toto téma je uzamčeno. Odpověď nelze zaslat.

0