You must Sign In to post a response.
  • Category: SQL Server

    Retrive data in more then one table

    hi every one,
    how to retrive the data in more then one table without using joins and unions in sql.
  • #762783
    Hello Sadiq,

    You can user INTERSECT : You can use Intersect Key word, which gives you common records.

    SELECT column1
    FROM table1
    SELECT column1
    FROM table2

    You can do by this query also :

    select A.column1, A.column2
    from table1 A, table2 B
    where A.column1 = B.column1

    You will get the complete result set in above query.

    Intersect will not return duplicates.

    Hope you understand.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762785

    Good Response working good

    what is advantage for INTERSECT?

    Join and intersect shows same output so

    which is best ? why

    INTERSECT Quickly fetch the records?

    can you explain.

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762786
    Hi Kumar,

    INTERSECT does all columns, INNER JOIN only the specified columns.

    Also INTERSECT creates a temporary table and INNER JOIN works on the actual table.

    INTERSECT operator returns almost same results as INNER JOIN clause many times.

    Hope it helps you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762794
    Thank you for nice response.

  • #762832
    Intersect, union, union all, except are set operators in sql sever. They are used to combine results of two or more select queries. SQL joins used to combine columns and set operators used to join rows from different select queries.

  • #763227

    Select * from Table1 inner join Table1
    on Table1.Column1=Table2.Column

    Select * from Table1 union Select * from Table2

    Select * from Table1 intersect Select * From Table2

    Hope This will help


  • Sign In to post your comments