From: David Johnston <polobo@yahoo.com>
To: pgsql-general@postgresql.org
Subject: Re: need help
Date: Fri, 16 Aug 2013 07:34:02 -0700 (PDT)
Message-ID: <1376663642799-5767617.post@n5.nabble.com> (raw)
In-Reply-To: <1376660155863-5767611.post@n5.nabble.com>
References: <1376058047506-5766954.post@n5.nabble.com>
<1376660155863-5767611.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Basavaraj wrote
> i have two unrelated tables as their is no common column to apply joins or
> anything, so i want to join those tables...
I can understand being required to join them (for some unstated reason) but
a simple want does not seem a strong enough reason to go through the pain...
> ...using simple query...
If you have to join these tables together the complexity of the resultant
query should be irrelevant. Furthermore how one defines "simple" is quite
subjective.
> finally the result shoule be
>
> name| address|email|mobileNo|firstname|lastName|
> --------------------------------------------------
> abc some1 mail1 1234564 def xyz
>
> 5 records | 10 records
>
> |
>
> Very thankful for solution............
I have no clue what you mean when you indicate "5 records | 10 records" in
the final result.
I'm tempted to ask you leading questions but instead am going to ask that
you consider your goal more closely and be more explicit in your
description/request.
If you just want to go and play with it you can consider two possible
options:
SELECT * FROM tbl1 CROSS JOIN tbl2 --(this will return X times Y rows - or
10 times 5 = 50)
or <not valid SQL, just an example>
SELECT *
FROM (SELECT row_number, * FROM tbl1) t1
FULL OUTER JOIN (SELECT row_number, * FROM tbl2) t2 USING (row_number)
-- this will return 10 rows with 5 of them containing NULL values for t1
columns where t2 has row numbers not existing in t1.
What you are doing, by the example given, is wrong. Proposing an
alternative is impossible since you have not explained WHY you feel you need
to do this or WHAT you are actually trying to accomplish.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Here-is-my-problem-tp5766954p5767617.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: polobo@yahoo.com
Subject: Re: need help
In-Reply-To: <1376663642799-5767617.post@n5.nabble.com>
References: <1376058047506-5766954.post@n5.nabble.com> <1376660155863-5767611.post@n5.nabble.com> <1376663642799-5767617.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox