Jump to content

IF select this, ELSE select that


scarhand

Recommended Posts

You'll be able to see what I'm trying to do:

 

$sql = $db->query("select s.*, u.displaygroupid as did, 
                   if(did = 0, u.usergroupid as gid, u.displaygroupid as gid)
                   (select opentag from " . TABLE_PREFIX . "usergroup where usergroupid = gid) as opentag,
                   (select closetag from " . TABLE_PREFIX . "usergroup where usergroupid = gid) as closetag
                   from " . TABLE_PREFIX . "shoutbox as s, " . TABLE_PREFIX . "user as u
                   order by id desc limit " . $vbulletin->options['ddsb_show'] . "");

 

Doesn't work. Can someone show me the proper way of writing this query?

Link to comment
https://forums.phpfreaks.com/topic/152121-if-select-this-else-select-that/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.