May 27, 2008 at 8:19 am
i had a tabel (movie) it has movieId,movieName,rate,Price
i wanna set the price 12000*2 if the movie Name is 'fofo'
else
if the movieName is 'lili' price should be 25000/2
how can i write this?can u help me?
May 27, 2008 at 8:29 am
Something like...
update movie
set price = case when movieName = 'fofo' then 12000*2 when movieName = 'lili' then 25000/2 end
where movieName in ('fofo', 'lili')
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 27, 2008 at 11:28 pm
but
update movie
set price = case when movieName = 'fofo' then 12000*2 when movieName = 'lili' then 25000/2 end
where movieName in ('fofo', 'lili')
doesn't work
May 27, 2008 at 11:37 pm
you mean it isn't correct???
create trigger trigger_price
on Tbl_Flight
for insert
as
if adult = 1
begin
insert into Tbl_Flight(price) values (1500000)
return
end
else
if child = 1
begin
insert into Tbl_Flight(price) values (1500000*0.5)
return
end
else
if infant= 1
begin
insert into Tbl_Flight(price) values (1500000*0.2)
return
end
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply