SELECT *
FROM notifications
INNER JOIN COMMENT
ON COMMENT.id = notifications.source_id
WHERE idblog IN (SELECT blogs_id
FROM blogs
WHERE STATUS = "active")
INNER JOIN reportmsg
ON reportmsg.msgid = notifications.source_id
WHERE uid =: uid
ORDER BY notificationid DESC
LIMIT 20;
Hier bin ich INNER JOIN
ing notifications
mit comment
und reportmsg
; Dann filtern Inhalt mit WHERE
.Was wäre die richtige SELECT-Anweisung dafür?
Aber mein Problem ist, dass für die erste INNER JOIN
[das heißt, mit comment
], bevor notifications
mit comment
Beitritt, ich will SELECT
notifications.idblog
mit blogs.blogs_id
und passen nur die Zeilen, in denen blogs.status = "active"
.
Zum besseren Verständnis des Codes oben:
hier für INNER JOIN
, mit comment
Ich möchte SELECT
nur die Zeilen in notifications
deren idblog
Streichhölzer blogs.blogs_id
und hat status = "active"
. Die zweite INNER JOIN
mit reportmsg
muss nicht geändert werden. Es filtert nur durch uid
.
Die Sprache, die Sie mit relationalen Datenbanken zu interagieren wird SQL genannt, nicht PHP. Ich habe deine Frage entsprechend bearbeitet. –
Da 'COMMENT' ein Schlüsselwort ist, wäre ich vorsichtig und setze es um. –
@ bɪɡɪnə überprüfen Sie meine Antwort, ob es erfüllt oder nicht ... und sagen, was ich in meiner Antwort verpasst habe .. – Shiv