Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Insert into one table from another

Author  Topic 

melcraig
Starting Member

39 Posts

Posted - 2006-09-19 : 14:48:00
I have two tables: Reservations and tickets.

I want the value(5) to go into the RID along with the ticket, table, menu from tickets

INSERT INTO reservations (RID, Ticket, Table, Menu)
VALUES (5,
(SELECT Ticket, Table, Menu FROM Tickets
WHERE Session = 2 )
)

I don't know how to do this to make it work. Please help
Thanks, Mel

Gopi Nath Muluka
Starting Member

22 Posts

Posted - 2006-09-19 : 15:06:25
try this
INSERT INTO reservations (RID, Ticket, Table, Menu)
SELECT 5, Ticket, Table, Menu FROM Tickets
WHERE Session = 2

Thanks,
Gopi Nath Muluka
Go to Top of Page

melcraig
Starting Member

39 Posts

Posted - 2006-09-19 : 15:30:57
Thanks, that worked great.
Mel
Go to Top of Page
   

- Advertisement -