Du måste duplicera IF
ring dit. Till exempel:
SELECT
name,
IF(apple = 'brown', color1, color2) AS ripeness
FROM
apples
JOIN apple_type ON apple_type.color = IF(apple = 'brown', color1, color2)
Du måste duplicera IF
ring dit. Till exempel:
SELECT
name,
IF(apple = 'brown', color1, color2) AS ripeness
FROM
apples
JOIN apple_type ON apple_type.color = IF(apple = 'brown', color1, color2)