SELECT
t1.Name_Zh,
t1.LevelName,
t2.FatherID,
t2.NodeID,
t2.SP_ID,
(select CASE count(*) WHEN 0 THEN 'True' ELSE 'False' END
from taxon where FatherID = t2.NodeID ) as EndNode
FROM plantsp t1, taxon t2 ,taxonsystems t3
where t3.ID = t2.S_ID
and t2.SP_ID = t1.ID
and t3.id= '2802'
and t1.LevelName = 'City'
SELECT t1.Name_Zh,
t1.LevelName,
t2.FatherID,
t2.NodeID,
t2.SP_ID,
case when t.FatherID is null then 'True' else 'False' end EndNode
FROM plantsp t1,
taxon t2
left join taxon t on t.FatherID = t2.NodeID,
taxonsystems t3
WHERE t3.ID = t2.S_ID
AND t2.SP_ID = t1.ID
AND t3.id = '2802'
AND t1.LevelName = 'City'
group by t2.NodeID
今天碰到一个数据库问题,需要用到子查询,但尝试了一下发现它很慢: mysql> select * from abc_number_prop where number_id in (select number_id from abc_number_phone where phone = '82306839'); ...
``` SELECT s.*, (SELECT SUM(pay_price) AS total_money FROM hjmallind_order WHERE is_show = 1 AND is_delete = 0 AND store_id = 2 AND is_cancel = 0 AND is_sale = 1 ...```
mysql 关于子查询in条件问题记录 ####以下代码片段只为指明本次问题所用,不纠结好坏 1、外部条件改变内部查询方式 eg:select column1, column2, … from ( … select c1, c2 from t1 where t.c1 in ( select c1 ...