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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.