|
|
|
Junior Member
      
Group: Forum Members
Last Login: 7/3/2008 3:49:29 AM
Posts: 22,
Visits: 21
|
|
How to get the count(combination of distinct values of two columns together).
i am giving the query in the following way
select count(distinct INVENTORY_ITEM_KEY,COST_TYPE_KEY) from ITEM_COST_DETAILS_F
but it is giving error at INVENTORY_ITEM_KEY and ','
dixon
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 6/9/2008 2:55:55 PM
Posts: 185,
Visits: 2
|
|
You can concatenate the columns together:
select count(distinct INVENTORY_ITEM_KEY || COST_TYPE_KEY) from ITEM_COST_DETAILS_F
Be aware that this will convert both columns to a CHARACTER data type before concatenating them, so you'll want to make sure the format of the column will properly report all values.
Hope that helps.
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 8/2/2006 4:09:00 PM
Posts: 19,
Visits: 1
|
|
|
If the text conversion causes issues, you may want to try a GROUP BY of INVENTORY_ITEM_KEY,COST_TYPE_KEY instead of concatenating.
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/11/2007 7:46:00 AM
Posts: 4,
Visits: 1
|
|
have you try this : select count(*) from select INVENTORY_ITEM_KEY,COST_TYPE_KEY from ITEM_COST_DETAILS_F group by INVENTORY_ITEM_KEY,COST_TYPE_KEY ) as MYCOUNT
|
|
|
|