sql >> Databasteknik >  >> RDS >> Oracle

Hur infogas två rader?

Jag tror att du försöker filtrera bort värden som 07-AUG-15 men ditt gilla-mönster säger 07_% . Det borde vara

gal.name not like '07-%'

Dessutom är din sista del som påpekats nedan ingen mening; snarare bör du inkludera dessa villkor i huvudfrågan WHERE klausul.

and ( exists (select FIRSTNAME
                  from TCPD_PERSONEL_COPY
                  where (gal.name not like '07_%' AND 
                 gal.name not like 'TR_%' AND
                 gal.name not like 'ST_%' AND
                  gal.name not like 'KB_%'  AND
                   gal.name not like 'HS_%'  AND
                    gal.name is not null))

Din SELECT ska se ut

SELECT SUBSTR(NAME, 1, 50),SUBSTR( GIVEN_NAME, 1, 50), DEPARTMENT, PHONE, SUBSTR(MAIL, 1, 100), SUBSTR(LOGIN, 1, 255), SYSDATE 
FROM   gal 
WHERE ( NOT EXISTS (SELECT EMAIL1 
                     FROM   TCPD_PERSONEL_COPY 
                     WHERE  GAL.mail = TCPD_PERSONEL_COPY.email1)

        OR NOT EXISTS (SELECT userid
                         FROM   TCPD_PERSONEL_COPY 
                         WHERE  gAL.LOGIN = TCPD_PERSONEL_COPY.userid))
AND GAL.mail IS NOT NULL AND GAL.COUNTRY='GERMANY'
AND (            gal.name not like '07_%' OR 
                 gal.name not like 'TR_%' OR
                 gal.name not like 'ST_%' OR
                  gal.name not like 'KB_%'  OR
                   gal.name not like 'HS_%'  OR
                    gal.name is not null);



  1. MySQL:Trunkate Table vs Delete From Table

  2. PHP Varning vid start när du försöker ladda php_oci8.dll

  3. MySql Single Table, Välj de senaste 7 dagarna och inkludera tomma rader

  4. Extrahera Oracle LONG till sträng i VBA