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


Please Help Members By Posting Answers For Below Questions

Does pl/sql support create command?

743


How to raise user-defined exception with custom sqlerrm ?

863


Can a table contain multiple primary key’s?

806


who introduced sql?

754


Which certification is best for sql?

725






how many groups of data types? : Sql dba

728


Is left join inner or outer?

759


What are stuff and replace function?

772


What sql database should I use?

788


What do you know by pl/sql cursors?

759


What is user defined functions?

746


Is sql free?

677


what is 'mysqladmin' in mysql? : Sql dba

744


Is coalesce faster than isnull?

703


What is the difference between partitioning and sharding?

730