trying to combine items and find the average
Clash Royale CLAN TAG#URR8PPP
trying to combine items and find the average
I am trying to combine like opods and like dpods and find the average final_nr for each of these combinations.
select column_1, column_2, Column_3, final, cust_name
From big2
Where q_date > '2017-1-1'
and cust_name = 'XYZ, LLC'
and setup = 1
should look like
Column_1 Column_2 Column_3 final customer name
a b 3 $50 XYZ
a c 2 $45 XYZ
c d 5 $55 XYZ
Question is not clear ... elaborate it little more.
– IShubh
Aug 9 at 18:19
2 Answers
2
Try the following query-:
select Opod, Dpod, finlocked,avg(final_nr), cust_name
From analytics..ig_uly2
Where quote_date > '2017-1-1'
and cust_name = 'XYZ, LLC'
and setup = 1
group by Opod, Dpod, finlocked, cust_name
SQL Server
just use group by
and avg
aggregate function
and use in
clause as you consider two customer name
group by
avg
in
select Opod, Dpod, finlocked, avg(final_nr) as avgfinal, cust_name
From analytics..ig_uly2
Where quote_date > '2017-01-01'
and cust_name in( 'XYZ', 'LLC')
and setup = 1
group by Opod, Dpod, finlocked,cust_name
Thanks! I am new and learning! it worked!
– krissyo4
Aug 9 at 19:02
@krissyo4 if it helps then accept my answer please
– Zaynul Abadin Tuhin
Aug 9 at 19:03
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Use group by Opod ,Dpod
– Shivam
Aug 9 at 17:14