NewEra13 0 Posted October 26, 2017 Report Share Posted October 26, 2017 Hello i have these 2 metrics that works good so far: -- -------------------------------------------- -- Nb Unique Accounts -- ------------------------------------------- select count(distinct(O.user_id)) from DB.order O LEFT JOIN DB.orderCompleted OrC ON O.id = OrC.order_id where reason in ('2') -- -------------------------------------------- -- Nb Accounts that are eighter deactivated or invalid -- ------------------------------------------- select count(distinct(O.user_id)) from DB.order O JOIN DB.orderCompleted OrC ON O.id = OrC.order_id where reason (0,1) QUESTION#1: We now need a 3 rd metric that will caclculate the % of nb of accounts that are eighter deactivated or invalid. How could we acheive that ? QUESTION#2: We would also like to only have 1 big SQL performing all 3 small queries above in order to then use this unioned or joined big sql into a Business Intelligence Reporting Tool that allows to use sql coding in order to display it in a crossTab Thanks to all ! Quote Link to post Share on other sites
justsomeguy 1,135 Posted October 26, 2017 Report Share Posted October 26, 2017 You can use a select query as one of the fields to select, so you can have a select query that selects each of those values from the queries above, and does division to get the percentage. That's also how you would run all of them at once. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.