In

Description: Examples of the use of IN in a SQL statement

INSERT INTO temp_rep2_bucket
(SELECT account_id FROM temp_rep_bucket
WHERE LTRIM(account_id,' ') IN (SELECT customer_number FROM ra_customers)
AND ROWID = ROWID
AND ROWNUM < 30)
/
 
SELECT ORIG_SYSTEM_CUSTOMER_REF, ORIG_SYSTEM_BILL_ADDRESS_ID,ORIG_SYSTEM_SHIP_ADDRESS_ID
FROM ar_invoice_interface_headers
WHERE ORIG_SYSTEM_CUSTOMER_REF IN (SELECT ORIG_SYSTEM_CUSTOMER_REF FROM ar9.ar_invoice_interface_headers)
/
 
 
SELECT a.customer_number, a.primary_salesrep_id, b.account_id, b.people_id
FROM ra_customers a, temp_rep_bucket b
WHERE a.customer_number IN (SELECT LTRIM(account_id,' ') FROM temp_rep_bucket)
AND a.customer_number = (SELECT LTRIM(account_id,' ') FROM temp_rep_bucket)
AND a.primary_salesrep_id != b.people_id
/

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.