结合查询纵表

组合查询纵表有A表,结构如下:id,field,value查询目标:value为A且value为B的id写一个函数b(),入参,id,value

组合查询纵表
有A表,结构如下:
id,field,value

查询目标:value为A且value为B的id

写一个函数b(),入参,id,value。

select a.value from a where id = 参数id and value = 参数value

查询伪sql:

select * from a where b(a.id,'A') is not null and b(a.id,'B') is not null