SELECT
*
FROM
(
SELECT
id,
br_code,
NAME,
appointmenttype,
telephone,
bigcash,
remark,
apt_status,
operation_time,
valid_code
FROM
(
SELECT
a.id,
a.br_code,
a. NAME,
b. NAME AS appointmenttype,
a.telephone,
a.bigcash,
a.remark,
a.apt_status,
a.operation_time,
a.valid_code
FROM
(
jkh_para_aptmanage a
LEFT JOIN jkh_para_appointmenttype b ON ((a.apt_type = b. CODE))
)
WHERE
a.apt_status = 'Y01'
ORDER BY
a.apt_status,
a.apt_time
) A
UNION ALL
SELECT
id,
br_code,
NAME,
appointmenttype,
telephone,
bigcash,
remark,
apt_status,
operation_time,
valid_code
FROM
(
SELECT
a.id,
a.br_code,
a. NAME,
b. NAME AS appointmenttype,
a.telephone,
a.bigcash,
a.remark,
a.apt_status,
a.operation_time,
a.valid_code
FROM
(
jkh_para_aptmanage a
LEFT JOIN jkh_para_appointmenttype b ON ((a.apt_type = b. CODE))
)
WHERE
a.apt_status = 'Y02'
ORDER BY
a.apt_status,
a.operation_time DESC
) B
) C
LIMIT 0,
5;
*
FROM
(
SELECT
id,
br_code,
NAME,
appointmenttype,
telephone,
bigcash,
remark,
apt_status,
operation_time,
valid_code
FROM
(
SELECT
a.id,
a.br_code,
a. NAME,
b. NAME AS appointmenttype,
a.telephone,
a.bigcash,
a.remark,
a.apt_status,
a.operation_time,
a.valid_code
FROM
(
jkh_para_aptmanage a
LEFT JOIN jkh_para_appointmenttype b ON ((a.apt_type = b. CODE))
)
WHERE
a.apt_status = 'Y01'
ORDER BY
a.apt_status,
a.apt_time
) A
UNION ALL
SELECT
id,
br_code,
NAME,
appointmenttype,
telephone,
bigcash,
remark,
apt_status,
operation_time,
valid_code
FROM
(
SELECT
a.id,
a.br_code,
a. NAME,
b. NAME AS appointmenttype,
a.telephone,
a.bigcash,
a.remark,
a.apt_status,
a.operation_time,
a.valid_code
FROM
(
jkh_para_aptmanage a
LEFT JOIN jkh_para_appointmenttype b ON ((a.apt_type = b. CODE))
)
WHERE
a.apt_status = 'Y02'
ORDER BY
a.apt_status,
a.operation_time DESC
) B
) C
LIMIT 0,
5;