Reputation: 712
What is the syntax error in this query? I am unable to fix.
SELECT
wsd.sid,
wsd.data as node_id
FROM
webform_submitted_data wsd
JOIN (
SELECT
wsd.sid,
wsd.data as md_email
FROM
webform_submitted_data wsd
WHERE
wsd.nid=48 AND wsd.cid=5
) tbl_md_email tmm ON tmm.sid = wsd.sid
WHERE
wsd.nid=48 AND wsd.cid=4
Upvotes: 0
Views: 64
Reputation: 54
Maybe the error is because you are using the same alias in two select: "webform_submitted_data wsd"
Try to change the alias: "webform_submitted_data wsd1" and "webform_submitted_data wsd2" (for inner select)
SP.
Upvotes: 1
Reputation: 1249
Try this:
SELECT
wsd.sid,
wsd.data AS node_id
FROM
webform_submitted_data AS wsd
JOIN
(
SELECT
sid,
data AS md_email
FROM
webform_submitted_data
WHERE
nid=48 AND cid=5
) AS tmm ON tmm.sid = wsd.sid
WHERE
wsd.nid=48 AND wsd.cid=4;
Upvotes: 0