select clients with two billing currencies

  • I trying to determine which clients have more than one default currency from a table of sales data. It seems like a simple query but for some reason I can't wrap my head around it. any help would be greatly appreciate it

  • We want to see you do some work, so make an attempt.

    As a hint, group by the clients, count the currencies.

    And you'll need a HAVING clause.

  • thanks for the advice, i'll give it a go

  • it gives me the number of transactions for each currency not the customers that have two different currencies

    0000104691USD41

    0000104698USD450

    0000104707USD4

    0000104708USD266

    0000104710USD35

    0000104717CAD440

    0000104724CAD3

    I need to know if 0000104724 has orders in CAD and in USD or EUR as an example

    thanks

  • Show some code here, and we'll help you out. Seeing results doesn't help me figure out what you're doing wrong.

  • select distinct custno, currency, COUNT(currency) from tblSales

    group by custno, currency having currency = 'USD' or currency='CAD'

    order by custno

  • klanguedoc (5/6/2009)


    select distinct custno, currency, COUNT(currency) from tblSales

    group by custno, currency having currency = 'USD' or currency='CAD'

    order by custno

    Hi,

    from your codeing result for count of currency alwayes one,

    --only the customer having more than one currency

    select custno,COUNT(currency) from tblSales

    where currency in('USD','CAD')

    group by custno

    having COUNT(currency)>1

    --for all the records

    select custno,COUNT(currency) from tblSales

    where currency in('USD','CAD')

    group by custno

    ARUN SAS

  • Thanks Old Hand...this is fabulous

    kevin

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply