Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

having trouble with a sql SP statement

$
0
0
I have 3 records grouped by ticket number(it is a field in my table), in 2 of them I have the same stdesc but in the other one I have a description that contains FREIGHT' word. If sttot field >0 and stdesc contains FREIGHT' word, I would like to get the other description else just stdesc

I am trying to add this

stdesc=max(case when(sttot >0 and stdesc like '%FREIGHT') then (stdesc = stdesc is not like '%FREIGHT') else stdesc end),

to a sql statement and sql gave me the following message

Incorrect syntax near '='.

Viewing all articles
Browse latest Browse all 23857

Trending Articles