From: JohnE on
I have a situation in which a user will need to delete only the content of
one field for a record. For each record in the table there is a column
(field) called IsChildOf. On the webpage there will be a button that will
delete only the content (a number) of the field IsChildOf for the record.
So, if record ID 449945 has 25 in the IsChildOf and the person uses the
delete button, the 25 is deleted.
How is the DELETE statement constructed for something like that (I'm a noob
to sql)?
Thanks.
John
From: J M De Moor on
John

> On the webpage there will be a button that will
> delete only the content (a number) of the field IsChildOf for the record.
> So, if record ID 449945 has 25 in the IsChildOf and the person uses the
> delete button, the 25 is deleted.
> How is the DELETE statement constructed for something like that (I'm a noob
> to sql)?


Your spec is kind of unclear, but it sounds like you want to use UPDATE,
not DELETE, something like this:

UPDATE SomeTable
SET IsChildOf = NULL
WHERE recordID = 449945
;

If that's not it, how about some DDL and sample data?

Joe De Moor
From: JohnE on
I never gave update a thought. Had delete in mind and was working at it from
that angle. The update will work. Sometimes you don't see the forest for
the trees that are in the way.
Thanks.
John



"J M De Moor" wrote:

> John
>
> > On the webpage there will be a button that will
> > delete only the content (a number) of the field IsChildOf for the record.
> > So, if record ID 449945 has 25 in the IsChildOf and the person uses the
> > delete button, the 25 is deleted.
> > How is the DELETE statement constructed for something like that (I'm a noob
> > to sql)?
>
>
> Your spec is kind of unclear, but it sounds like you want to use UPDATE,
> not DELETE, something like this:
>
> UPDATE SomeTable
> SET IsChildOf = NULL
> WHERE recordID = 449945
> ;
>
> If that's not it, how about some DDL and sample data?
>
> Joe De Moor
> .
>