what is a sub query?how will you calculate working days in
a month using sub query?
Answer Posted / p.rajasekar
ex
1)Method
Table tab1 data like Followings
Month date1 Working
Jan 1 0
Jan 1 1
Jan 1 1
Jan 1 0
.
.
.
Then the query should be
select Month,count(Working) from monthname m where working=1
group by Month,working
You will get answer 2;
2 Method
If we store the working days in same column
eg like(1=>Denotes Working,0=>denotes off)
Month Day1
Jan 101010101111
select Month,length(trim(replace(b.Day1,'0','')))
NoofWorkDays from workdays b
Please test it.Let me know the feed back
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
How does postgresql compare to oracle/db2/ms sql server/informix?
What are the benefits of pl/sql packages?
what are the differences between binary and varbinary? : Sql dba
Why query optimization is needed?
Why do we use cursors?
What does select * from mean in sql?
What are sql functions? Describe in brief different types of sql functions?
What are the two different parts of the pl/sql packages?
Explian rowid, rownum?
What is pl sql variable?
Does sql*plus have a pl/sql engine?
What is the purpose of design view?
What does the acronym acid stand for in database management?
What is difference between my sql and sql?
What is a column in a table?