私の発言は正しいですか
$uid=1;
$pby=1;
$db->query("SELECT
CASE WHEN (c.uid!='$uid' and c.uid!='$pby')
THEN
( SELECT c.id, c.comment, c.uid,c.msgid, c.tstamp, u.fullname, u.img FROM
comments c join users u on c.uid=u.uid where c.msgid='$id' and
c.condition!='ga' order by c.tstamp desc limit 10)
)
ELSE
( SELECT c.id, c.comment, c.uid,c.msgid, c.tstamp, u.fullname, u.img FROM
comments c join users u on c.uid=u.uid where c.msgid='$id'
order by c.tstamp desc limit 10)
)
END
FROM comments c where c.msg_id='$id'") ;
これを試しましたが、空の結果がスローされます。何が悪いのかわからない
に更新
SELECT c.id、c.comment、c.uid、c.msgid、c.tstamp、u.fullname、u.img
CASE WHEN (c.uid!='$uid' and c.uid!='$pby')
THEN
( SELECT c.id, c.comment, c.uid,c.msgid, c.tstamp, u.fullname, u.img FROM
comments c join users u on c.uid=u.uid where c.msgid='$id' and
c.condition!='ga' order by c.tstamp desc limit 10)
)
ELSE
( SELECT c.id, c.comment, c.uid,c.msgid, c.tstamp, u.fullname, u.img FROM
comments c join users u on c.uid=u.uid where c.msgid='$id'
order by c.tstamp desc limit 10)
)
END
FROM comments c join users u on c.uid=u.uid where c.msgid='$id'