SQL Select ,Insert with multiple value

I have 2 table 1) Tenant ------primarykey
2) CalenderEvent-------TenantID,CalnderEvent

select t.primaryKey from tenants T,tenantRentals TR where tr.tenantID = t.primaryKey and tr.leaseEndDate > GETDATE()

from tenant table I am getting primarykey afcourse it is multiple value and  all this values

II want to insert in calender table as TenatID and also wants to insert same calender event for all TenantID.Is there any way I can do it....

Please let me know....
Itgirl16Asked:
Who is Participating?
 
appariConnect With a Mentor Commented:
try like this
Insert into CalenderEvent(TenantID,CalnderEvent)
select t.primaryKey, 'EventValue' 
from tenants T,tenantRentals TR where tr.tenantID = t.primaryKey and tr.leaseEndDate > GETDATE()

Open in new window

0
 
johanntagleCommented:

insert into CalendarEvent (TenantID, CalnderEvent)
select t.primaryKey, ColumnForCalendEvent
from tenants T, tenantRentals tr
where tr.tenantID = t.primaryKey and tr.leaseEndDate > GETDATE();

Is that what you need?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.