|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL Query help
Hello,
Can someone pls help me w/ the following query? I'm trying to select all the records in the LIST table who have both a matching Postal Code + Address in the CLIENTS table. UPDATE CLIENTS SET DNS='YES' WHERE PC IN (SELECT MAIL_CODE_UP FROM LIST WHERE PC=MAIL_CODE_UP) AND AD1 IN (SELECT ADDRESS1 FROM LIST WHERE ADDRESS1=AD1); COMMIT; |
|
#2
|
||||
|
||||
|
But PC corresponds to MAIL_CODE or MAIL_CODE_UP in LIST table?
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
Sorry, it should have read MAIL_CODE_UP, I fixed. But the problem is, it matches more than it should, for example in CLIENTS, PC 'M1N0P0' AD1 'PO BOX 21' will match LIST MAIL_CODE_UP'M1N0P0' ADDRESS1'PO BOX 789'
|
|
#4
|
||||
|
||||
|
|
|
#5
|
|||
|
|||
|
I keep getting an invalid column reference error . Don't I have to select the LIST table first or something?
|
|
#6
|
||||||||
|
||||||||
sql Code:
or sql Code:
don't have Oracle at hand, sorry. |
|
#7
|
|||
|
|||
|
thank you very much, that worked!
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > SQL Query help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|