我有以下查询来提取属性。属性有多个单位。我不知道如何使用至少 1 个单位提取属性。单元通过具有相同的“团队”连接到属性。“团队”是一个 varchar(例如“jkdgsl”)。有什么建议么?
SELECT DISTINCT Properties.id, Properties.title, Properties.team
FROM Properties
INNER JOIN Units ON Units.team = Properties.team
AND Units.rates != '0'
AND Properties.deleted = '0000-00-00 00:00:00'
AND Properties.zip_code
IN (
'77808', '77845'
)
AND Properties.public = '1'
ORDER BY FIELD( Properties.zip_code, '77808', '77845' )
LIMIT 0 , 30