随笔分类 - DB -- Mysql
摘要:select id,title from za_item where -- id in (1003,1000)返回的结果第一条是对应id是1000,第二条是1003。如果我们想让结果和in里面的排序一致,可以这么做。select id,title from za_item whereid in (1...
阅读全文
摘要:有clients和lead_sources俩表。mysql数据库。lead_sources表结构类似:clients表中的lead_source_id是外键。现在要统计某时间段内client内每种lead_source所占百分比select a.L_name, ROUND((a.L_sub_count*1.0/b.total_count*100),1) as perTotal,a.L_sub_count,b.total_countfrom(SELECT LeadSource.name as L_name, count(*) as L_sub_countFROM clients as Clien
阅读全文

浙公网安备 33010602011771号