Home > database > Packet count (*) to 0 records don't show?
Packet count (*) to 0 records don't show?
Time:09-22
Select count (*), business_id from tb_smp_sms_history_201409 t where latn_id=919 and business_id (1005001100002100003) in group by business_id
CodePudding user response:
Business_id (1005001100002100003) this is a condition in Find need through the summary record, then I have nothing to do with this condition the Data in the table there is no record of 1005003 group of natural won't appear in the results
CodePudding user response:
So that how to put the empty record displayed such
0, 1005003
CodePudding user response:
I put the count (*) to NVL (count (*), 0) or not so 3 records
CodePudding user response:
- this will use outside link way, the machine didn't know that you want to display the three numerical conditions, With mt as ( Select the from 1005001 c dual Union all Select the from 1005002 dual Union all Select the from 1005003 dual ) Select mt. C, count (*) The from mt left join tb_smp_sms_history_201409 t on business_id=mt c Where latn_id=919 Group by mt. C
CodePudding user response:
Union all...
CodePudding user response:
Do you have any similar code tables: business_id With business_id coding table and your query left connection:
The select a. usiness_id NVL (b.b 1, 0) combined From the chart a left join (select count (*), b1, business_id from tb_smp_sms_history_201409 t where latn_id=919 and business_id (1005001100002100003) in group by business_id) b On a. usiness_id=b.b usiness_id Group by a. usiness_id ;