SELECT LEFT(RIGHT(进场时间,8),2), 车牌号,进场时间,支付时间 FROM 停车收费详情$;
1是周日,7是周六SELECT COUNT(*),周几 FROM date_parts WHERE (LEFT(进场时间,10) BETWEEN '2017-09-25' AND '2017-10-08') AND ((UNIX_TIMESTAMP(出场时间)-UNIX_TIMESTAMP(进场时间))/86400 BETWEEN 5 AND 50 )GROUP BY 周几SELECT (UNIX_TIMESTAMP(出场时间)-UNIX_TIMESTAMP(进场时间)),车牌号,进场时间 FROM date_parts; SELECT LEFT(进场时间,10),((UNIX_TIMESTAMP(出场时间)-UNIX_TIMESTAMP(进场时间))/1800) FROM date_parts WHERE LEFT(进场时间,10) BETWEEN '2017-09-01' AND '2017-09-14'; SELECT COUNT(*),LEFT (车牌号,2) FROM date_parts WHERE 周几 BETWEEN 23 AND 24 GROUP BY LEFT(车牌号,2) ORDER BY COUNT(*) DESC;SELECT COUNT(*),LEFT (车牌号,2) FROM date_parts WHERE ((UNIX_TIMESTAMP(出场时间)-UNIX_TIMESTAMP(进场时间))/86400 BETWEEN 5 AND 100 )GROUP BY LEFT(车牌号,2) ORDER BY COUNT(*) DESC;