0
我需要選擇狀態='過期'的另一個狀態爲'未售出'的bid-id有人可以幫忙嗎?從同一列中選擇2個值
SELECT *,
SelectBidID, DATENAME(mm, Date) AS Month
FROM BID
WHERE (Status = 'Won')
我需要選擇狀態='過期'的另一個狀態爲'未售出'的bid-id有人可以幫忙嗎?從同一列中選擇2個值
SELECT *,
SelectBidID, DATENAME(mm, Date) AS Month
FROM BID
WHERE (Status = 'Won')
試試這個
SELECT *, SelectBidID, DATENAME(mm, Date) AS Month,
Case [Status]
When 'expired' Then 'sucessfull'
When 'unsold' Then 'unsucessfull'
--Else 'Unknown'
End As [Status]
FROM BID
WHERE [Status] = 'expired'
OR [Status] = 'unsold'
WITH Unsold AS
(SELECT *,
Select BidID, DATENAME(mm, Date) AS Month
,Status As U_Status
FROM BID
WHERE (Status = 'unsold')
),Expired AS
(SELECT *,
SelectBidID, DATENAME(mm, Date) AS Month
,Status as E_Status
FROM BID
WHERE (Status = 'expired')
)
Select s.*, s.U_Status, e.E_Status from Unsold s
INNER JOIN Expired e ON s.SelectBidID =e.SelectBidID
我需要分別在兩個值,如所有過期和全部流拍,我就會把這個圖表 – user3287068
請。讓你的問題有更多的細節和簡潔。 – Jade
你是什麼意思分開的,因爲你已經可以按狀態分開它們了? – Jade