I have four tables like Mytable1,Mytable2,Mytable3,Mytable4
Mytable1 and Mytable2 have one similar field rest al different,
Mytable2 and Mytable3 have one similar field rest al different,
Mytable3 and Mytable4 have one similar field rest al different,

i have to select from four tables by matching with all these field.

OK, let's say that the "similar field" in MyTable1 is Field1, and the "similar field" in MyTable2 is Field2 etc, then I think you want to create a view:

CREATE VIEW MyTables
    AS
          SELECT Field1, otherFields1 AS MyField FROM MyTable1
       UNION ALL
          SELECT Field2, otherFields2 FROM MyTable2
       UNION ALL
          SELECT Field3, otherFields3 FROM MyTable3
       UNION ALL
          SELECT Field4, otherFields4 FROM MyTable4;

and thereafter simply query it as if it is one big table:

SELECT * FROM MyTables WHERE MyField is desiredValue;

I put in "otherFields" since I'm assuming that you want to return some fields other than the one you're searching.

Tom



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to