Hi,
Is this possible to run a query from already written query like
select distinct salary from (select user_id, sum(salary) from emp where month =3 group by user_id) ;
this is an example so consider we are having 10 different sum of salary ...but i want to figure that out from select * from select query ....
Thanks for reverting back ..
Yes, you can do nested queries.
If you want to continue work on a query that is already definied, save it into a table by using create table ... as select ...
Yes, you can do that no problem, its called a subquery when another one is nestled in brackets. I would however wonder why you are doing it like that, there are times to use subqueries, however from what you have said and posted, I don't think this is one of them. Perhaps post some test data and required output. Just from what you have posted, assuming it is differing months then:
select user_id, sum(salary) from emp group by month,user_id
rather than several queries. Also note that distinct salary may return more than one row from your query, so how will handle that?
Yes RW9@ & KurtBremser... i agree there are multiple ways but couldn't bring them that time so used that..
actually i used earlier select a,b from (select id ,cat from T 1 where some condition) aliasname....as i forgot to put this alias name so it makes me to put question here on discussion portal ...but thanks for the effrort you guys put ..i appreciate it .thanks..
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.