Kendprasanth wrote:Ken,kcbland wrote:Ever seen SQL like this?
Code: Select all
select (select count(1) from your_attendance table yat where yct.customer_key=yat.customer_key and some_criteria... ) "FIRST_METRIC", (select count(1) from your_attendance table yat where yct.customer_key=yat.customer_key and some_other_criteria... ) "SECOND_METRIC", (select count(1) from your_attendance table yat where yct.customer_key=yat.customer_key and even_more_criteria... ) "THIRD_METRIC", (select case when yat.attendance_date between '01-jul-2004' and '01-jul-2005' then yat.gross_dollars else yat.net_dollars end from your_attendance table yat where yct.customer_key=yat.customer_key and even_more_criteria... ) "FOURTH_METRIC", from your_customer_table yct where customers_are_these_guys...
How may multiple single row subqueries can we include at a time. I mean taking your example, you have FOUR single sub queries. In that way , what is the maximum sub queries we can have?
I did try whatever you have told me at the first instance. It worked perfectly fine. The above question was just out of curiosity. Now I know that there is no relevance for whatever I asked. Sorry about that.
Thanks a lot for helping me out.