Jump to content

Sql Groupby Multiple Columns(Sub Grouping) Help Plz


Recommended Posts

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

  • Silver_mani

    11

  • ParmQ

    10

  • dotnetrockz

    8

  • dkchinnari

    4

Top Posters In This Topic

Posted

 

 

You are using it in aggregate function kadha? Using it in the aggregate function and using the same in the group by may not work.

Posted

Baa, use partition by clause over Rank or row number.
 

Row no assign chesina kuda you have to group again on ur keys and Do the sum of the row no

Posted

select transactiondate,max(category),count(category) from #temp
group by transactiondate,category

idhi try chey

Posted

Row no assign chesina kuda you have to group again on ur keys and Do the sum of the row no

Yes, just partition by will not work.

Posted
select transactiondate,max(category),count(category) from #temp
group by transactiondate

idhi try chey

 

 

Adhi ela? you are not inserting anything into temp table. And you are not reading from an actual table.
 

Posted

Adhi ela? you are not inserting anything into temp table. And you are not reading from an actual table.
 

nenu sample ga rasanu script na DB lo.. temp table is main table akkada

Posted

count(*) doesnt work either

 

nenu check chesa mama ...it should work ...whats ur query ??
 

Posted

nenu sample ga rasanu script na DB lo.. temp table is main table akkada

 

Got it.
 

Posted

Final ga try this.

 

SELECT transactiondate, Category,   COUNT(*) as count
FROM Table
GROUP BY transactiondate, Category
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC

Posted

count(*) doesnt work either

 

intaki em db uncle....Oracle lo ayithe should work....is it mysql or sqlserver?

Posted

Bhaya china example hope this will work


Select a,b,c , d as count from (table name) group by a,b,c having count(*) > 1

Posted

nenu check chesa mama ...it should work ...whats ur query ??
 

pls stop coming to DB..thanks for ur support  and understanding...

Posted

Final ga try this.

SELECT transactiondate, Category COUNT(*) count
FROM Table
GROUP BY transactiondate, Category
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC

correct
Posted

Bhaya china example hope this will work


Select a,b,c , d as count from (table name) group by a,b,c having count(*) > 1

this is basically to check the no of duplicates on Keys .

×
×
  • Create New...