pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gurudutt <guru@indvalley.com>
To: Markus Bertheau <twanger@bluetwanger.de>
Cc: postgres sql list <pgsql-sql@postgresql.org>
Subject: Re: Joins~ - Thanks a lot~
Date: Fri, 23 Nov 2001 13:41:43 +0530
Message-ID: <1575268728.20011123134143@indvalley.com> (raw)
In-Reply-To: <1006502123.4636.0.camel@entwicklung01.cenes.de>
References: <13216589307.20011121140728@indvalley.com>
	<1006343880.29221.13.camel@entwicklung01.cenes.de>
	<10524699358.20011122161018@indvalley.com>
	<1006502123.4636.0.camel@entwicklung01.cenes.de>

Hello Markus,

It worked like anything, Thanks a lot, actually it saved so much of my
code in php, infact a function had been writted to do the same.

Thanks again

-- 
Best regards,
 Gurudutt                            mailto:guru@indvalley.com

Life is not fair - get used to it.
Bill Gates


Friday, November 23, 2001, 1:25:22 PM, you wrote:

>> select tickettab.tokenid, ticketmultab.techcode,ticketmultab.techcode,
>> tickettab.problemstmt,ticketmultab.problemstmt
>> from (tickettab LEFT JOIN ticketmultab ON tickettab.tokenid=ticketmultab.tokenid)
>> as ticketjoinedtab order by
>> ticketjoinedtab.arrivaldate desc,
>> ticketjoinedtab.arrivaltime desc
MB> Oh, I see, joining is of course false, my fault. must be like this, i
MB> think:
MB> select <fields> from tablea union select <the same fields> from tableb
MB> order by <field>

MB> I tried it with two sample tables on 7.1.3 and it worked:
bert=>> select version();
MB>                            version                           
MB> -------------------------------------------------------------
MB>  PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.96
MB> (1 row)

bert=>> \d ta
MB>                              Table "ta"
MB>  Attribute |  Type   |                   Modifier                    
MB> -----------+---------+-----------------------------------------------
MB>  id        | integer | not null default nextval('"ta_id_seq"'::text)
MB>  data      | text    | 
MB>  i         | integer | 
MB> Index: ta_id_key

bert=>> \d tb
MB>                         Table "tb"
MB>  Attribute |  Type   |              Modifier              
MB> -----------+---------+------------------------------------
MB>  id        | integer | default nextval('ta_id_seq'::text)
MB>  data      | text    | 
MB>  i         | integer | 

bert=>> select * from ta;
MB>  id | data | i 
MB> ----+------+---
MB>   1 | qwe  | 1
MB>   2 | ert  | 3
MB>   3 | tzu  | 5
MB> (3 rows)

bert=>> select * from tb;
MB>  id | data | i 
MB> ----+------+---
MB>   4 | wer  | 2
MB>   5 | rtz  | 4
MB>   6 | zui  | 6
MB> (3 rows)

bert=>> select * from ta union select * from tb order by i;
MB>  id | data | i 
MB> ----+------+---
MB>   1 | qwe  | 1
MB>   4 | wer  | 2
MB>   2 | ert  | 3
MB>   5 | rtz  | 4
MB>   3 | tzu  | 5
MB>   6 | zui  | 6
MB> (6 rows)

MB> Markus Bertheau




Message-ID: <1575268728.20011123134143@indvalley.com>
Permalink:  ../1575268728.20011123134143@indvalley.com/
Also on:    postgresql.org/message-id/1575268728.20011123134143@indvalley.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: guru@indvalley.com, twanger@bluetwanger.de
  Subject: Re: Joins~ - Thanks a lot~
  In-Reply-To: <1575268728.20011123134143@indvalley.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