Rockin' the SQL

Sep 13, 2007 20:48

I had a great day at work today. In fact, this week has been pretty great at work.

Long braggadoccio posting )

oracle, work

Leave a comment

Comments 4

silverize September 14 2007, 03:56:03 UTC
Ah... sweet, sweet geekery.

I don't tend to use WHERE EXISTS but I should try it. I tend to do subqueries like WHERE xyz in (select xyz from...)

Reply

brcmapgirl September 14 2007, 12:28:48 UTC
It is a subquery, but it's important to pull back only one result for each record. That's the key.

Reply


ipsin September 14 2007, 04:37:01 UTC
You're doing an "UPDATE ... WHERE EXISTS"... Is it possible that using MERGE would be better?

Reply

brcmapgirl September 14 2007, 12:30:24 UTC
MERGE would work if I am doing an UPDATE/INSERT aka UPSERT-ing. But it's only an update and no new insert should be created. For every record pulled from table B, there is an entry on A, because A helps to generate B.

Therefore when I am done, the changed record count should be the total number of records on B.

Reply


Leave a comment

Up