Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Querying from the result of another query.

$
0
0

The following query gives me a list of FaxIDs whose file path column does not start with C:\ and that haven't already been identified according to the identified table.

SELECT [FaxID] FROM [FaxQueue] WHERE [FilePath] NOT LIKE 'C:\%'
AND [FaxID] NOT IN (SELECT [FaxID] FROM [Identified]);

I have some more code that send's an email to alert whoever that the following records don't have a correct filepath.

Now the list of FaxIDs need to be re-used to insert into the identified table. The identified table has just one column which keeps track of which FaxIDs that have been identified as not having a falid file path.

INSERT INTO [identified] VALUES (???)

I don't know what to stick in for the ?s... do I simply copy and paste my first query into the question marks?

How can I "save" the list of FaxIDs from the first query into some kind of data structure so I can send them in an e-mail (sp_send_dbmail)?


-Nothing to see. Move along.




Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>