(SELECT *
FROM remedi.meds_donation
WHERE state_short_name IN ('TN')
AND request_date between "2018-10-01 00:55:48" AND "2018-11-29 13:02:14"
)
union all
(SELECT *
FROM remedi.meds_donation
WHERE state_short_name NOT IN ('TN')
AND request_date between "2018-09-01 00:55:48" AND "2018-10-29 13:02:14"
)
ORDER BY request_date DESC
答案 0 :(得分:0)
order by必须排在第二位,或者联合必须是子查询
也许你是说
const signUpCall = store.getActions()[0]
expect(signUpCall).toHaveBeenCalledWith({
email: 'foo@gmail.com',
username: 'foo',
password: '12345678'
});
但我认为更好
SELECT * FROM (
(SELECT *
FROM remedi.meds_donation
WHERE state_short_name IN ('TN')
AND request_date between "2018-10-01 00:55:48" AND "2018-11-29 13:02:14"
)
union all
(SELECT *
FROM remedi.meds_donation
WHERE state_short_name NOT IN ('TN')
AND request_date between "2018-09-01 00:55:48" AND "2018-10-29 13:02:14"
)
) T ORDER BY request_date DESC
答案 1 :(得分:0)
尝试
SELECT *, (CASE WHEN state_short_name IN ('TN') then 0 else 1 END) as state_order
FROM remedi.meds_donation
WHERE request_date between "2018-10-01 00:55:48" AND "2018-11-29 13:02:14"
ORDER BY state_order asc, request_date DESC