i have one table with accounts and amounts as
colums.accounts with columns c and d. and amounts with
values 1000,2000,3000 for c and 4000,5000,8000 for d.i need
to find the sum of these accounts c and d individually
and find the differences between their sum using one select
statement.
Answer Posted / bunty
Hi,
I dont know if this is a intended way for which interviewer
has asked, but it will definitely give an answer,
select (select sum(value) from test_tab where parent='D')-
(select sum(value) from test_tab where parent='C')
difference from dual;
Cheers,
Bunty
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
how to create a new table in mysql? : Sql dba
how is exception handling handled in mysql? : Sql dba
What is rownum?
What are different functions in sql?
How do I run a sql query?
What is meaning of <> in sql?
Explain what is rdbms?
How to write html code in pl sql?
What are secondary keys?
how to calculate expressions with sql statements? : Sql dba
What is foreign key and example?
What are the advantages of sql? Explain
What action do you have to perform before retrieving data from the next result set of a stored procedure ?
What makes a good primary key?
Why are indexes and views important to an organization?