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.
| Author |
Topic |
|
gemispence
Yak Posting Veteran
71 Posts |
Posted - 2006-03-07 : 15:56:09
|
| The query below should be inserting unique records in the PropertyItem table which only has propertyitem, propertyid, and itemid columns, all of which are PK's in other tables. I'm not doing the insert correctly b/c it's inserting 72 records instead of 24. I really just want to automatically insert the values once I've inserted in the other tables but I'm not sure how. Maybe On Update Cascade?--PROPERTYITEMINSERT INTO [USCONDEX_Production].[dbo].[propertyItem]( [propertyId], [ItemId])SELECT Property.propertyId, ITEM.ItemIDFROM ITEM RIGHT OUTER JOIN miamiherald ON ITEM.StartDate = miamiherald.FirstInsertDate AND ITEM.Price = miamiherald.PropertyPrice AND ITEM.Classified = convert(int,miamiherald.AdNumber) LEFT OUTER JOIN Property ON property.adprintid = miamiherald.adprintid WHERE validAD=1 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|