[postgis-users] postgres case(conditional)statement problem

zhang zhe luckyclare at hotmail.com
Sat Dec 4 04:45:36 PST 2010


Hello,

Does anyone familiar with postgres case statement. 

I have a tale called selling1.sql, inside table there are two columns
item(1,1,2,3,3,3,4,4,4....)  and price(234, 243, 245, 342, 124, 245, 343, 123,455.....). I want to select the price where item id is equal to 1, and if its price is bigger than 200 and smaller than 300, the price will be changed into 400 . so in this case, price column value will be changed into,  price(400,400, 245,342,124, 245, 343, 123, 455...)

My sql statement is like this

select price from selling1 where selling1.item = '1',
 case when 200<selling1.price and selling1.price <300 then '400'else 'other' END;

but it always give me the error. It said syntax error in case. 

Do you known whatś wrong? 

Thanks

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101204/f3719940/attachment.html>


More information about the postgis-users mailing list