What I am trying to do is
* Insert a record for EMPLOYEE A to TABLE A
IF
the sum of the hours worked by EMPLOYEE A on TABLE A
is not equal to N

Is this possible?







On 8/31/05, Michael Fuhr <[EMAIL PROTECTED]> wrote:
On Wed, Aug 31, 2005 at 11:09:54AM -0400, Henry Ortega wrote:
> Is there a way to insert a record only if a certain
> condition is met?
>
> Something like:
> insert into employee values('lastname','firstname',8) where
> (condition here.. select sum(ofsomething) from xx where sum(ofsomething)>0 )

See the INSERT documentation; it mentions inserting values from a subquery.

INSERT INTO employee
SELECT 'lastname', 'firstname', 8
WHERE <condition>;

--
Michael Fuhr


Reply via email to