sql - Delete where not in query -


I have a lookup table ( ## lookup ). I know this is a bad design because I'm repeating the data, but it increases my quotes very much. I have a query that populates this table.

  ## , Separate Call 1, Cola 2, ... Join the Table 1 ... Join ... etc ... in ...  

I would like to emulate this behavior: Remove deleted search ## from deleted ## ######################## ..ETC ...

This will update the table correctly but it is very easy to insert and delete. It messes with my indexes and locks the table to choose.

This table can also be updated as something like:

 remove from removing from  ## Separate call 1, cola 2, ... select table1 ... join ... etc ...) ## Enter in Lookup (except for separate call 1, cola 2, ... from Table 1 ... Add ... etc.) if this table Already, so on the other hand it may take more time, but I can say "with a lock" and I will be able to select from the table.  

Any ideas about how to write a query in another way?

  Delete LU # to ## Look Luft Outer Join Table 1 T1 On T1 My_pk = LU.my_pk WHERE T1.my_pk ## Select Lookup (my_pk, col1, col2 ...) T1.my_pk, T1.col1, T1 .col2 ... to Table 1 T1 left OUTER JOIN ## Look LU is on LU.my_pk = T1.my_pk WHERE LU.my_pk IS NULL  

You can also use the above pairs Ws to see the non-existence of RO.

If you are on SQL 2008 then you would also like to see in the Emerging Statement. Otherwise, you do not keep tables in sync - you are only keeping PK in sync. If one of the columns changes into a table, but not the second which will not be reflected above.

Either way, it seems that you might want to consider optimizing the query. By duplicating the data, it may look like a good improvement for your performance problems, as you can see that it can take many headaches with it (and this is the only one). You are better at finding the underlying cause of poor performance and instead of putting this ugly bandade.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -