Adding records from two SQL Server tables that are unique on one column -


I have two tables in a SQL Server database, which contain letters with a post and one of the documents sent electronically Is one. / [P>

  Make Table [DBO]. [DocumentTransmission] ([PatentNumber] [varchar] (50) null, [filename] [varchar] (512) No tap, [infected datetime] [datetime2] (3) tap, [gpc] [Date] [50] Null, [status] [Wakahar] (50) Null, [email address] [Varchar] (64) NULL, [DateTimeAdded] [datetime2] (3) NULL) [Primary]  

The other table is called DocumentPrint

>

me DocumentTransmission And only need to select the record from DocumentPrint , where files Name appears in no DocumentTransmission - and I can not seem to know how to make DBA cry early because it is very slow - How do you suggest that it is done.

there is no adding a record to SQL However, you merge Two (or more) SELECT results can be combined with a UNION . Something like this: Choose from

  * Select Document Transmission Union * From Document Print  

Since you want to exclude rows from second condition , From which you need to add a condition:

  from selection * Select the Document Coordination Union * Print with the document where the file name is not (choose filename from the document transmission)  

But this query is not expected very fast: you Programming are very long than VARCHAR column and if many rows in the table if it is slow to be


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -