0

hi
I want to fetch data from four tables using a single query.please tell me how to do that.
thanks in advance

3
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by varmadba
0

hi
I want to fetch data from four tables using a single query.please tell me how to do that.
thanks in advance

try select * from a, b, c, d

then sort out at your leisure :D

0
select table1.*,table2.*,table3.*,table4.* from table1
inner join table2
  on table1.column1=table2.column1
inner join table3
  on table1.column1=table3.column1
inner join table4
  on table1.column1=table.column1

change table names and column names accordingly

0

put your create table syntax for all 4 tables
then some 1 can send a exact query

Obviously a task too overcharging him. Why not letting him doing plain cross products first a la posting #2 ?

0

select * from a, b, c, d
this will produce a Cartesian output

say you have 100 rows in each table
o/p will be 100 x 100 x 100 x 100

you know why it doesn't have how to join tables

0

correct, it is cartesian product, not cross product. thank you, varmadba :)

True, the cardinality is just the total product of the cardinalities of all involved tables. But this might be ok to him. So he would learn how to figure out the essential rows manually doing true handiwork.

0

did i write Cross product in my post,
if so my my...

how feasible it is to handwork output if you have trusted DB to do that

dont think so...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.