0
我有兩個conditions..i SQL結果需要在ASP同一列打印此兩個條件顯示它..檢查兩個SQL條件,並在同一列
SQL查詢
select P.[Port Name], CR.Name as country,CASE
when SIH.[Ship-to Code] = '' then (select C.Name from [Customer] C where C.No_ = SIH.[Sell-to Customer No_])
end as name,
case
when SIH.[Ship-to Code] = '' then (select C.Address from [Customer] C where C.No_ = SIH.[Sell-to Customer No_])
end as addr,
case
when SIH.[Ship-to Code] = '' then (select C.[City] from [Customer] C where C.No_ = SIH.[Sell-to Customer No_])
end as city
from [Sales Invoice Header] SIH, [Port] P, [Country_Region] CR where No_ = 'PEXP1213-523' and P.Code = SIH.Port
and CR.Code = SIH.[Country of Final Destination]
union all
select P.[Port Name], CR.Name as country,
case
when SIH.[Ship-to Code] <> '' then (select C.Name from [Ship-to Address] C where C.Code = SIH.[Ship-to Code] and C.[Customer No_] = SIH.[Sell-to Customer No_])
end as name,
case
when SIH.[Ship-to Code] <> '' then (select C.[Address] from [Ship-to Address] C where C.Code = SIH.[Ship-to Code] and C.[Customer No_] = SIH.[Sell-to Customer No_])
end as addr,
case
when SIH.[Ship-to Code] <> '' then (select C.[City] from [Ship-to Address] C where C.Code = SIH.[Ship-to Code] and C.[Customer No_] = SIH.[Sell-to Customer No_])
end as city
from [Sales Invoice Header] SIH, [Port] P, [Country_Region] CR where No_ = 'PEXP1213-524' and P.Code = SIH.Port
and CR.Code = SIH.[Country of Final Destination]
請再具體些。你的SQL查詢是什麼? –
這是我的SQL query..i我檢查等於空的條件,不等於空狀態......我得到了無論是在SQL中conditin結果......但我不能夠得到不等於空狀態asp .. – Affan
不能製造混亂的頭部或尾部。選擇No_,確保它們都被找到。 PS你爲什麼不在第一次加入客戶,在第二次送貨地址? –