select count(1)
from zdy_travel_agency_info a
inner join sys_user b on a.sys_user_id = b.user_id
b.del_flag = '0'
${params.dataScope}
select count(1)
from zdy_device_gate g
del_flag != 1
${params.dataScope}
select count(1)
from zdy_point_data a
left join zdy_point_type b on a.point_type_id = b.id
a.del_flag = '0'
and b.del_flag = '0'
and b.potype_name = #{params.type}
${params.dataScope}
select count(1)
from zdy_device_handheld h
del_flag = '0'
${params.dataScope}
select b.name `name`, a.`value`
from (select d.ticket_id, count(d.id) `value`
from zdy_ticket_order_detail d left join zdy_ticket_order_item i on d.order_item_id =i.id
d.del_flag = '0'
and d.payment_type = 200
and d.create_time >= CURRENT_DATE - INTERVAL DAY(CURRENT_DATE) - 1 DAY
${params.dataScope}
group by d.ticket_id) a
left join zdy_ticket b
on a.ticket_id = b.id
order by a.`value` desc limit 5
select zto.order_source `name`, count(ztod.id) `value`
from zdy_ticket_order_detail ztod
left join zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
left join zdy_ticket_order zto on ztoi.order_id = zto.id
where ztod.del_flag = '0'
and ztod.payment_type = 200
and ztod.create_time >= CURRENT_DATE - INTERVAL DAY (CURRENT_DATE) - 1 DAY ${params.dataScope}
group by zto.order_source
order by `value` desc
select count(ztod.id)
from zdy_ticket_order_detail ztod
left join zdy_ticket_order_item ztoi
on ztod.order_item_id = ztoi.id
where ztod.payment_type = 200
and ztod.del_flag = '0'
and ztod.create_time >= CURRENT_DATE - INTERVAL DAY (CURRENT_DATE) - 1 DAY ${params.dataScope}
SELECT DATE_FORMAT(create_time, '%Y-%m') `name`, sum(ifnull(buy_quantity, 0)) `value`
FROM zdy_ticket_order_item ztoi
WHERE del_flag = 0
and payment_type = 200
and create_time >= CURDATE() - INTERVAL 1 YEAR ${params.dataScope}
GROUP BY `name`
order by `name` asc
select DATE_FORMAT(t.create_time, '%Y-%m') `name`, sum(ifnull(buy_quantity, 0)) `value`
from (select MAX(a.create_time) create_time, MAX(a.buy_quantity) buy_quantity
from zdy_ticket_order_detail a
left join zdy_ticket_order_detail_child b on a.id = b.order_detail_id
left join zdy_ticket_order_item ztoi on a.order_item_id = ztoi.id
WHERE a.del_flag = 0
and a.payment_type = 200
and a.create_time >= CURDATE() - INTERVAL 1 YEAR
and (a.verification_time is not null
or b.verification_time is not null ) ${params.dataScope}
group by a.id) t
GROUP BY `name`
order by `name` asc
SELECT DATE_FORMAT(ztod.create_time, '%Y-%m') `name`,
sum(ifnull(ztod.actua_amount, 0)) `value`
FROM zdy_ticket_order_detail ztod
left join zdy_ticket_order_item ztoi
on ztod.order_item_id = ztoi.id
WHERE ztod.del_flag = 0
and ztod.payment_type = 200
and ztod.create_time >= CURDATE() - INTERVAL 1 YEAR ${params.dataScope}
GROUP BY `name`
order by `name` asc
select count(1) todayOrderCount
from (SELECT 1
FROM zdy_ticket_order_item ztoi
left join zdy_ticket_order zto on ztoi.order_id = zto.id
WHERE ztoi.del_flag = 0
and ztoi.payment_type = 200
and DATE (ztoi.create_time) = CURDATE() ${params.dataScope}
group by zto.id) a
select count(1) todayVerificationOrderCount
from (select count(1)
from zdy_ticket_order_detail a
left join zdy_ticket_order_item b on a.order_item_id = b.id
left join zdy_ticket_order c on b.order_id = c.id
left join zdy_ticket_order_detail_child d on d.order_detail_id = a.id
where a.del_flag = 0
and a.payment_type = 200
and (a.verification_time is not null or d.verification_time is not null)
and (DATE (d.verification_time) = CURDATE() or DATE (a.verification_time) = CURDATE())
${params.dataScope}
group by c.id) t
SELECT ifnull(SUM(actua_amount), 0) todaySaleTotalAmount
FROM zdy_ticket_order_detail ztod
left join zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
WHERE ztod.del_flag = 0
and ztod.payment_type = 200
and DATE (ztod.create_time) = CURDATE() ${params.dataScope}
select count(1) todayOrderCount
from (SELECT 1
FROM zdy_ticket_order_item ztoi
left join zdy_ticket_order zto on ztoi.order_id = zto.id
WHERE ztoi.del_flag = 0
and ztoi.payment_type = 200
and DATE (ztoi.create_time) >= CONCAT(YEAR(NOW()), '-01-01') ${params.dataScope}
group by zto.id) a
select count(1) todayVerificationOrderCount
from (select count(1)
from zdy_ticket_order_detail a
left join zdy_ticket_order_item b on a.order_item_id = b.id
left join zdy_ticket_order c on b.order_id = c.id
left join zdy_ticket_order_detail_child d on d.order_detail_id = a.id
where a.del_flag = 0
and a.payment_type = 200
and (a.verification_time is not null or d.verification_time is not null)
and (DATE (d.verification_time) >= CONCAT(YEAR (NOW()), '-01-01') or DATE (a.verification_time) >= CONCAT(YEAR (NOW()), '-01-01'))
${params.dataScope}
group by c.id) t
SELECT ifnull(SUM(actua_amount), 0) todaySaleTotalAmount
FROM zdy_ticket_order_detail ztod
left join zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
WHERE ztod.del_flag = 0
and ztod.payment_type = 200
and ztod.create_time >= CONCAT(YEAR(NOW()), '-01-01')
${params.dataScope}
(select ztod.identity_card
from zdy_ticket_order_detail ztod
left join zdy_ticket_order_detail_child ztodc on ztod.id = ztodc.order_detail_id
left join zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
where ztod.del_flag = 0
and ztod.payment_type = 200
and ztod.identity_card is not null
and (ztod.verification_time is not null
or ztodc.verification_time is not null)
${params.dataScope}
group by ztod.identity_card)
t
select CONCAT(FLOOR(h / 2) * 2, '-', FLOOR(h / 2) * 2 + 2) `name`, count(1) `value`
from (select hour (`hour`) h
from (select case
when MAX(ztodc.verification_time) is null then ztod.verification_time
else MAX(ztodc.verification_time) end `hour`
from zdy_ticket_order_detail ztod
left join zdy_ticket_order_detail_child ztodc on ztod.id = ztodc.order_detail_id
left join zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
where ztod.del_flag = 0
and ztod.payment_type = 200
and (ztod.verification_time is not null or ztodc.verification_time is not null)
and (DATE (ztod.verification_time) = CURRENT_DATE () or DATE (ztodc.verification_time) = CURRENT_DATE ())
${params.dataScope}
group by ztod.id) t) t1
group by `name`
select za.name `name`, t2.value `value`
from (select p, count(1) value
from (select SUBSTR(identity_card, 1, 2) p
from (select ztod.identity_card
from zdy_ticket_order_detail ztod
left join zdy_ticket_order_detail_child ztodc on ztod.id = ztodc.order_detail_id
left join zdy_ticket_order_item ztoi on ztod.order_item_id = ztoi.id
where ztod.del_flag = 0
and ztod.payment_type = 200
and ztod.identity_card is not null
${params.dataScope}
and (ztod.verification_mun > 0
or ztodc.verification_num > 0)
group by ztod.identity_card) t) t1
group by p) t2
left join zdy_area za on za.short_code = p
where za.name is not null
order by `value` desc
select count(identity_card)
from
0 and age <= 18 then 1 else 0 end) as '18岁以下',
sum(case when age > 18 and age <= 35 then 1 else 0 end) as '18-35岁',
sum(case when age > 35 and age <= 60 then 1 else 0 end) as '35-60岁',
sum(case when age > 60 then 1 else 0 end) as '60岁以上'
]]>
from (select t.identity_card, YEAR (CURRENT_DATE) - substr(t.identity_card, 7, 4) + 1 age
from
) t1
select count(1) `value`,
case when substr(identity_card, 17, 1) / 2 = 0 then '女士' else '男士' end `name`
from
group by `name`