Grandy Grandy - 1 month ago 6
MySQL Question

Set SQL field value equal to other field value on insert

I want to insert into a table structure like this:

ID | CLIENT_ID | NAME | DESCRIPTION | …


ID
is the auto increment primary.
CLIENT_ID
can appear multiple times for multiple versions.

How can i set
CLIENT_ID
on a
INSERT
statement same as the - in this statement - auto generated primary
ID
?

Something like this:

INSERT INTO clients SET client_id=id, name='test', description='yada'

Answer

Just noticed that is possible exactly how i wrote it:

INSERT INTO clients SET client_id=id, …
Comments