i have a table which has two columns i'd fill one of the columns by selecting other table column data but how can i fill the next column cause i can't use VALUE. Here's the code
INSERT INTO Numbers(number, val) SELECT LaptopID FROM Laptop WHERE Laptop.Pid = 2
as you can see the "val" column left empty how can i fill that?
Use NULL
if the column allows it:
INSERT INTO Numbers(number, val)
SELECT LaptopID, NULL
FROM Laptop WHERE Laptop.Pid = 2
Or use the intended (hardcoded) value that you want.
If number:
INSERT INTO Numbers(number, val)
SELECT LaptopID, 2
FROM Laptop WHERE Laptop.Pid = 2
or if text:
INSERT INTO Numbers(number, val)
SELECT LaptopID, 'val'
FROM Laptop WHERE Laptop.Pid = 2