Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a blank record
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00880105
Message ID:
00880124
Views:
15
>I have two temporary tables in a stored prcedure that is used for reporting for a project of mine. What I want to do is look through table A and for all recrods NOT in table B add a new record to show zero sales. What is the best way to accomplish this?

Kelly,

Try
INSERT INTO #tablea 
  SELECT keyfield, 0, 0, 0, ... 
    FROM #tableb WHERE keyfield NOT IN (SELECT keyfield FROM @tablea)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform