Quantcast
Channel: Answers for "Please Suggest a query for the below Scenario"
Viewing all articles
Browse latest Browse all 4

Answer by Sri 1

$
0
0
select distinct trandate, (Select MAX(empname) from emp e where e.empid=s.empid), sum(tranamt) from [sales trans] s group by trandate,s.empid having SUM(tranamt)>50000 ---it will give you per day per emp per sum(tranAmt on that day) if greater than 50K. you can remove trandate from select if you need just name and amount as we group by trandate here..

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images