Jump to content

How to make this query better ?


plusnplus

Recommended Posts

Hi,

my query is:

select distinct cust_id from tabel_sales where item_code !='110' and cust_id not in (select cust_id from table_sales where item_code='110')

 

purpose of the query is to get customer that NOT have item code 110.

 

this query work fine, but take very long time (for 12.000 record plus)

Link to comment
https://forums.phpfreaks.com/topic/195782-how-to-make-this-query-better/
Share on other sites

After run few test, the query not run properly.

for more info:

table_sales record is like:

cust_id          item_id      item_qty

abc                100            100

abc                110            100

abc                120            100

abb              100            100

abb                120            100

abb                130            100

aba                110            100

aba                120            100

aba                130            100

 

Thanks for any help/ idea

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.