Try the following query:
SELECT (CASE WHEN state = '1' THEN 'Accepted' WHEN state = '-2' THEN 'Waiting' WHEN state = '-1' THEN 'Archived' WHEN state = '0' THEN 'Rejected' ELSE 'Unknown' END) AS Status, s.names, s.phone, FROM_UNIXTIME(datetime1,'%d/%m/%y %T'), s.begin, s.PickupAddr1, s.end, s.PickupAddr4, s.message, s.selpassengers, s.selluggage, IF(s.returntrip=0, 'No', 'Yes'), IF(FROM_UNIXTIME(datetime2,'%Y') = '1970', NULL, FROM_UNIXTIME(datetime2, '%d/%m/%y %T')), tc.title AS Vehicle, s.cprice, pm.title As Payment, s.payment, s.selinfantseats, s.selchildseats, s.selboosterseats, s.selcarry, s.email, s.id, s.prepay, s.vehicletype FROM #__taxibooking_orders s
INNER JOIN #__taxibooking_cars tc ON tc.id = s.vehicletype
INNER JOIN #__taxibooking_paymentmethods pm ON pm.id = s.payment
INNER JOIN #__users u ON s.email = u.email
INNER JOIN #__user_usergroup_map ugm ON u.used_id = u.id
INNER JOIN #__usergroups g ON ugm.group_id = g.id
WHERE g.title = 'supervisor'
GROUP BY s.id
Regards,
ARI Soft
|