我需要带有一些前缀和后缀的 mySql 结果。这是我的代码:
SELECT bk_id, bk_rtype, villas_db.v_name AS villa_name
FROM booking_db
INNER JOIN villas_db ON booking_db.bk_vid = villas_db.v_id
WHERE '2012-11-02'
BETWEEN bk_date1
AND bk_date2
ORDER BY bk_id DESC
LIMIT 0 , 30
结果是:
bk_id bk_rtype villa_name
30 2 T2
29 3 V1
所以我需要结果为:
bk_id bk_rtype villa_name booking_no
30 2 T2 B2-00030
29 3 V1 B3-00029
而 B 是由“-”和 sprintf("%05d",bk_id); 分隔的预订前缀;
请建议。