I have this sql:
SELECT a.member_id, b.date, b.type, d.K_id, d.title, a.login
FROM members as a
JOIN permissions as b ON b.member_id = a.member_id
JOIN titles as d ON d.k_id = b.k_id
WHERE a.member_id = '$member'
ORDER BY b.date DESC
I want to select the login where type equals '3'. Can this be done without another select query?
I should rephrase based on the answers below .....I meant I wanted to select where type = 3 FROM t开发者_Go百科he results of this query.
SELECT a.member_id, b.date, b.type, d.K_id, d.title, a.login
FROM members as a
JOIN permissions as b
ON b.member_id = a.member_id
JOIN titles as d
ON d.k_id = b.k_id
WHERE a.member_id = '$member' and b.type = '3'
ORDER BY b.date DESC
or
WHERE a.member_id = '$member' and b.type = 3
depending on the type of type.
How about:
SELECT a.member_id, b.date, b.type, d.K_id, d.title, a.login
FROM members as a
JOIN permissions as b
ON b.member_id = a.member_id
JOIN titles as d
ON d.k_id = b.k_id
WHERE a.member_id = '$member' AND b.type = '3'
ORDER BY b.date DESC
精彩评论