我正在使用MySql,请参阅http://postimg.org/image/waso0lsnf/以查看我的表结构。 我想获取department_id
其中enduser_to_department = Y
以及department_to_enduser = Y
。 价值可能在同一行不同的行department_id.
在mysql中获取不同行的值
我试过以下的方式,但它的工作单行。
SELECT `departments`.`department_id`, `departments`.`department`
FROM `custom_forms_departments` , `departments`
WHERE departments.department_id = custom_forms_departments.department_id
AND (`custom_forms_departments`.`enduser_to_department` = 'Y'
OR `custom_forms_departments`.`department_to_enduser` = 'Y')
GROUP BY `departments`.`department_id`
ORDER BY departments.department_id DESC
http://postimg.org/image/waso0lsnf/
编辑:从URL添加的图像。
世界上没有附模式/结构...我们需要更多信息继续。 – Fazer87
请按照编辑的问题检查http://postimg.org/image/waso0lsnf/。 – pratik
那么您尝试过哪些SQL? –