Select a. GCMC as fname, A. jsdw as fowner,Case
When B. FID is null then-1 else B. FID end as farea,
A. content as fcontent, A. updatetime as ftime, null as fhref, A. deleted as fisdel
From z_bidding a left join ccic_area B on charindex (B. fname, A. areaid)> 0
And
Select a. GCMC as fname, A. jsdw as fowner,Case B. FID
When null then-1 else B. FID end as farea,
A. content as fcontent, A. updatetime as ftime, null as fhref, A. deleted as fisdel
From z_bidding a left join ccic_area B on charindex (B. fname, A. areaid)> 0
The execution results are different.
A. Easy to use Case Function Select Statement
Use Adventureworks;
Go
Select Productnumber, category =
Case Productline
When ' R ' Then ' Road '
When ' M ' Then ' Mountain '
When ' T ' Then ' Touring '
When ' S ' Then ' Other sale items '
Else ' Not for sale '
End ,
Name
From Production. Product
Order By Productnumber;
Go
B. Easy to use Case Functions and Case Search function Select Statement
Use Adventureworks;
Go
Select Productnumber, name, ' Price Range ' =
Case
When Listprice = 0 Then ' MFG item-not for resale '
When Listprice < 50 Then ' Under $50 '
When Listprice > = 50 And Listprice < 250 Then ' Under$ 250 '
When Listprice > = 250 And Listprice < 1000 Then ' Under$ 1000 '
Else ' Over $1000. '
End
From Production. Product
Order By Productnumber;
Go