我的表單中有兩種類型的交易1)One way relocation deal and 2)Regular deal
。我的db -Vehicles中有一個表。使用ORDER BY子句在MYSQL中排序數據
vehicles table
=====================================================
id, pickuplocation, returnlocation, included location
現在,當用戶選擇One way relocation deal
然後在數據庫中,只有id,pickuplocation,returnlocation
將插入和coloumn included location
將是無效的。而當用戶選擇Regular deal
,列pickuplocation,returnlocation
西港島線是空只有coloumn id and included location
將set.Problem是我想用自己的location.I嘗試此查詢的整個數據進行排序 -
SELECT *
FROM vehicles
where 1=1
ORDER BY pickuplocation ASC,returnlocation ASC
但它不會給予適當結果,因爲具有包括location.how空我可以排序的所有pickuplocation,returnlocation,exculded location
你想去哪裏空項才能出現? – Mark
您是否想要'pickup位置','returnlocation'和'排除位置'在一列中並進行排序?你想如何處理'null'? –
$條件的內容是什麼?你爲什麼要放一個'1 = 1'的條件? –