[英]MariaDB: Select from a table colum based on another table field value
id like to make a select in a specific field in table A based on the field name on a table B: id 喜欢根据表 B 上的字段名称在表 A 的特定字段中创建 select:
Table A:表 A:
id , name , value, field
1 , Test, 30, age
Table B:表 B:
id, name, date, username, email, password, birthdate, age, gender, optin
1, Robson, 2020-05-12, rob, rob@email.com, passwd, 1982-12-31, 37, M, 1
i need to make a select in table b like it:我需要在表 b 中制作一个 select ,如下所示:
SELECT TABLEB.(TABLEA.FIELD) from TABLEB where TABLEA.value>=TABLEB.(TABLEA.FIELD)
how to do that?怎么做?
Something like this...像这样的东西...
SELECT
CASE TABLEA.FIELD
WHEN 'age' THEN TABLEB.AGE
WHEN 'gender' THEN TABLEB.GENDER
-- etc
ELSE NULL
END CASE
AS X
FROM TABLEA
WHERE TABLEA.VALUE > X
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.