Re: [SQL] using min|max in where

2010-08-25 Thread Bruce Momjian
Ben Carbery wrote: > Hi, I have some sql like so: > > SELECT min(date) INTO d FROM interest_rate WHERE m_code = NEW.code; > UPDATE interest_rate SET date = NEW.start_date, rate = NEW.initial_rate > WHERE m_code = NEW.code AND date = d; > > Actually this is pgsql but I don't think that matters. >

[SQL] using min|max in where

2010-08-24 Thread Ben Carbery
Hi, I have some sql like so: SELECT min(date) INTO d FROM interest_rate WHERE m_code = NEW.code; UPDATE interest_rate SET date = NEW.start_date, rate = NEW.initial_rate WHERE m_code = NEW.code AND date = d; Actually this is pgsql but I don't think that matters. I am wondering if I can make this