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
What are the advantages of sql? Explain
What is foreign key and example?
what is a table in a database ? : Sql dba
What are the most important characteristics of pl/sql?
What operators deal with null?
Is pl sql and postgresql same?
how to get a list of columns in an existing table? : Sql dba
How can triggers be used for the table auditing?
Why do we need pl sql?
Is t sql a programming language?
What does count (*) do in sql?
what is oltp (online transaction processing)? : Sql dba
How much does sql cost?
Is it possible to sort a column using a column alias?
How can I delete duplicate rows?