I have a 2 table structure:
RID; Name; LP
E F 1
E F 2
E F 3
E F 12
E F 152
LP
1
2
3
12
152
...
156
157
180
itd.
Query something like:
Insert into TableA(RID, Name, LP) Values ('E', 'F', Select LP from TableB)
I want to achive:
RID; Name; LP
E F 1
E F 2
E F 3
E F 12
E F 152
E F 156
E F 157
E F 180
etc.
You're close. Try
INSERT INTO TableA(RID, Name, LP)
SELECT 'E', 'F', LP FROM TableB
-- Omit this where clause, if duplicate LP's are OK
WHERE TableB.LP NOT IN (SELECT LP FROM TableA)
Insert into TableA(RID, Name, LP)
Select
'E', 'F', LP
from
TableB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With