general questions about joins in queries

From: Zlatko Matić <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
To: <pgsql-general(at)postgresql(dot)org>
Subject: general questions about joins in queries
Date: 2006-01-16 17:01:53
Message-ID: 000001c61b55$4eec0aa0$52bffea9@zlatkovyfkpgz6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.
Is it better to use A) or B) ?

A)

SELECT
"public"."departments".*,
"public"."plants".*,
"public"."batches_microbs".*,
"public"."results_microbs".*
FROM
"public"."departments",
"public"."plants",
"public"."batches_microbs",
"public"."results_microbs"
WHERE
"plants"."department" = "departments"."department" AND
"batches_microbs"."plant" = "plants"."plant" AND
"results_microbs"."batch" = "batches_microbs"."batch"

B)

SELECT
"public"."departments".*,
"public"."plants".*,
"public"."batches_microbs".*,
"public"."results_microbs".*
FROM
public.departments
INNER JOIN public.plants ON (public.departments.department = public.plants.department)
INNER JOIN public.batches_microbs ON (public.plants.plant = public.batches_microbs.plant)
INNER JOIN public.results_microbs ON (public.batches_microbs.batch = public.results_microbs.batch)

Thanks,

Zlatko

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Orlando Giovanny Solarte Delgado 2006-01-16 17:10:50 Create/Erase 5000 Tables in PostGRE SQL in execution Time
Previous Message Zlatko Matić 2006-01-16 15:33:11 Re: visual query builder for Postgres?