31.1.16

Multiple Queries with a Single ResultSet

How to merge multiple queries and produce a single result set??

1. UNION:

   Union helps to merge Two Queries but on condition that

  • Both queries returns same number of columns
  • The selected columns in both queries have matching data type


Incorrect Union Mapping



Correct Union Mapping


2. JOINS:

    Joins can be used when both the queries have a mapping column to match and fetch result set.



Cheers,
Venkatesan Prabu .J
Managing Director – KaaShiv Info Tech / MSP-MVP Mentor
www.kaashivinfotech.com

No comments:

Post a Comment