表1
TYPE | ID | PRICE | SIZE
A 1 100 4
A 2 150 8
B 3 400 12
参考
FIELD_ID | LONG
A Llamas
B Alpacas
C Cats
D Dogs
我想要得到结果:
TYPE | ID | PRICE | SIZE
llamas | 1 | 100 | 4
llamas | 2 | 150 | 8
Alpacas| 3 | 400 | 12
我尝试过使用
SELECT TYPE, ID, PRICE, SIZE, Reference.FIELD_ID, Reference.LONG
FROM Table1
LEFT JOIN Reference on TYPE = Reference.FIELD_ID
WHERE (PRICE BETWEEN '0' AND '200') AND
(SIZE BETWEEN '1' AND '10')
仅返回[“TYPE”] => “A”和[“FIELD_ID”] => NULL