I have 8 stores that have route ids for shipment schedule. I.e: store 4552 = D1 store 4860 = D2.... I want to append the route number to all my unique stores but i have to idea how to do that for all unique values.
我有8家商店有发货时间表的路线ID。即:门店4552=D1门店4860=D2...我想要将路线编号附加到我的所有唯一商店,但我必须知道如何为所有唯一的值执行此操作。
SELECT id as shipment_id, purchase_order, concat(ship_to,'-D1'), created_at, ship_on
FROM `table1-production.warehouser_.fulfillment_orders`
WHERE reservation_id = 1730
order by (created_at) asc
I dont know how to write the if statement to append the route number
我不知道如何编写if语句来追加路线编号
enter image description here
在此处输入图像描述
更多回答
Which SQL database are you using (SQL server, Oracle, MySQL, etc.)?
您使用的是哪种SQL数据库(SQL服务器、Oracle、MySQL等)?
by
is not a function. Simply write order by created_at asc
, to make code clearer.
By不是一个函数。只需编写ORDER BY CREATED_AT ASC,以使代码更清晰。
In which table are those route ids stored?
这些路由ID存储在哪个表中?
no table. I'm thinking this would need an if statement. i.e if daiso-4552 then add D1. if daiso-4341 then add D2. Output would be daiso-4552-D1 and daiso-4341-D2
没有桌子。我想这需要一条if语句。也就是说,如果是DAISO-4552,则添加D1。如果是DAISO-4341,则添加D2。输出将是DAISO-4552-D1和DAISO-4341-D2
优秀答案推荐
我是一名优秀的程序员,十分优秀!