From jumboc@comcast.net Sat Jan 3 02:10:23 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3AE3ED1DF89 for ; Sat, 3 Jan 2004 02:10:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 88339-07 for ; Fri, 2 Jan 2004 22:09:40 -0400 (AST) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by svr1.postgresql.org (Postfix) with ESMTP id 8116FD1CA3E for ; Fri, 2 Jan 2004 21:15:43 -0400 (AST) Received: from andy2 (c-24-1-39-92.client.comcast.net[24.1.39.92]) by comcast.net (sccrmhc12) with SMTP id <2004010301154901200e9jqpe>; Sat, 3 Jan 2004 01:15:50 +0000 From: "Andy Lewis" To: Subject: sort by on two columns Date: Fri, 2 Jan 2004 19:15:49 -0600 Message-ID: <002101c3d197$20082f20$0201a8c0@andy2> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0022_01C3D164.D56DBF20" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_60_70 X-Spam-Level: X-Archive-Number: 200401/9 X-Sequence-Number: 16402 This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C3D164.D56DBF20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi All, Is it possible to sort by two columns? Using the query below? SELECT table1.name, table2.name, FROM table1, table2 WHERE table1.id = table2.id ORDER BY I want to be able to sort the names select from two different tables and two different colums(same data type). Is this possible? Thanks, Andy ------=_NextPart_000_0022_01C3D164.D56DBF20 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message
Hi=20 All,
Is it pos= sible to=20 sort by two columns? Using the query below?
 
SELECT ta= ble1.name,=20 table2.name, <other selected columns> FROM table1, table2 W= HERE=20 table1.id =3D table2.id ORDER BY <what?>
 
I want to= be able to=20 sort the names select from two different tables and two different colums(sa= me=20 data type).
 
Is this= =20 possible?
 
Thanks,
 
Andy
------=_NextPart_000_0022_01C3D164.D56DBF20-- From grzm@myrealbox.com Sat Jan 3 03:16:26 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A7D9ED1D8B2 for ; Sat, 3 Jan 2004 03:16:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 00552-04 for ; Fri, 2 Jan 2004 23:15:44 -0400 (AST) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id 11A21D1DD61 for ; Fri, 2 Jan 2004 22:40:15 -0400 (AST) Received: from [10.0.1.3] grzm@smtp-send.myrealbox.com [68.112.116.204] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.47 $ on Novell NetWare; Fri, 02 Jan 2004 19:40:29 -0700 In-Reply-To: <002101c3d197$20082f20$0201a8c0@andy2> References: <002101c3d197$20082f20$0201a8c0@andy2> Mime-Version: 1.0 (Apple Message framework v609) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <2E86574A-3D96-11D8-A298-000A95C88220@myrealbox.com> Content-Transfer-Encoding: 7bit Cc: From: Michael Glaesemann Subject: Re: sort by on two columns Date: Fri, 2 Jan 2004 20:40:24 -0600 To: "Andy Lewis" X-Mailer: Apple Mail (2.609) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/11 X-Sequence-Number: 16404 Hi Andy, On Jan 2, 2004, at 7:15 PM, Andy Lewis wrote: > Is it possible to sort by two columns? Using the query below? > > SELECT table1.name, table2.name, FROM table1, > table2 WHERE table1.id = table2.id ORDER BY > > I want to be able to sort the names select from two different tables > and > two different colums(same data type). If you want to order by table1.name and table2.name, just enter them in a comma-separated-list after ORDER BY, e.g., SELECT table1.name, table2.name, FROM table1, table2 WHERE table1.id = table2.id ORDER BY table1.name, table2.name Check out the following link for the online docs: It doesn't explicitly give you an example of sorting on more than one column, but the syntax explanation at the top includes it. Does this help? Michael Glaesemann grzm myrealbox com From jumboc@comcast.net Sat Jan 3 03:25:37 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4691ED1B437 for ; Sat, 3 Jan 2004 03:25:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 00819-10 for ; Fri, 2 Jan 2004 23:24:56 -0400 (AST) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by svr1.postgresql.org (Postfix) with ESMTP id 7C6CFD1C941 for ; Fri, 2 Jan 2004 22:55:31 -0400 (AST) Received: from andy2 (c-24-1-39-92.client.comcast.net[24.1.39.92]) by comcast.net (sccrmhc13) with SMTP id <20040103025530016008ukmme>; Sat, 3 Jan 2004 02:55:30 +0000 From: "Andy Lewis" To: "'Michael Glaesemann'" Cc: Subject: Re: sort by on two columns Date: Fri, 2 Jan 2004 20:55:30 -0600 Message-ID: <003a01c3d1a5$0cb603d0$0201a8c0@andy2> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 In-reply-to: <2E86574A-3D96-11D8-A298-000A95C88220@myrealbox.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/12 X-Sequence-Number: 16405 Hi Michael, Yes, I understand this but, I would like to have the results of both "table1.name, table2.name" sorted as one column. Is this possible? Thanks, Andy -----Original Message----- From: Michael Glaesemann [mailto:grzm@myrealbox.com] Sent: Friday, January 02, 2004 8:40 PM To: Andy Lewis Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] sort by on two columns Hi Andy, On Jan 2, 2004, at 7:15 PM, Andy Lewis wrote: > Is it possible to sort by two columns? Using the query below? > > SELECT table1.name, table2.name, FROM table1, > table2 WHERE table1.id = table2.id ORDER BY > > I want to be able to sort the names select from two different tables > and > two different colums(same data type). If you want to order by table1.name and table2.name, just enter them in a comma-separated-list after ORDER BY, e.g., SELECT table1.name, table2.name, FROM table1, table2 WHERE table1.id = table2.id ORDER BY table1.name, table2.name Check out the following link for the online docs: It doesn't explicitly give you an example of sorting on more than one column, but the syntax explanation at the top includes it. Does this help? Michael Glaesemann grzm myrealbox com From grzm@myrealbox.com Sat Jan 3 03:29:18 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C2713D1B454 for ; Sat, 3 Jan 2004 03:29:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 01948-06 for ; Fri, 2 Jan 2004 23:28:37 -0400 (AST) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id 37B69D1D30C for ; Fri, 2 Jan 2004 23:04:13 -0400 (AST) Received: from [10.0.1.3] grzm@smtp-send.myrealbox.com [68.112.116.204] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.47 $ on Novell NetWare; Fri, 02 Jan 2004 20:04:18 -0700 In-Reply-To: <003a01c3d1a5$0cb603d0$0201a8c0@andy2> References: <003a01c3d1a5$0cb603d0$0201a8c0@andy2> Mime-Version: 1.0 (Apple Message framework v609) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <85E086DE-3D99-11D8-A298-000A95C88220@myrealbox.com> Content-Transfer-Encoding: 7bit Cc: From: Michael Glaesemann Subject: Re: sort by on two columns Date: Fri, 2 Jan 2004 21:04:19 -0600 To: "Andy Lewis" X-Mailer: Apple Mail (2.609) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/13 X-Sequence-Number: 16406 On Jan 2, 2004, at 8:55 PM, Andy Lewis wrote: > Yes, I understand this but, I would like to have the results of both > "table1.name, table2.name" > sorted as one column. > > Is this possible? So you want one column of name, including names from both table1 and table2? In that case, you need to use UNION, I believe. If it's something else, I'm not sure I understand what you're asking. Perhaps you could include a sample of what you're getting, along with what you'd like to see? Michael Glaesemann grzm myrealbox com From chris@travelamericas.com Sat Jan 3 05:21:37 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DB74ED1CCAA for ; Sat, 3 Jan 2004 05:21:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 03696-09 for ; Sat, 3 Jan 2004 01:20:49 -0400 (AST) Received: from noon.pghoster.com (noon.pghoster.com [64.246.0.64]) by svr1.postgresql.org (Postfix) with ESMTP id 52C68D1B4AE for ; Sat, 3 Jan 2004 01:20:48 -0400 (AST) Received: from [61.5.0.24] (helo=winxp) by noon.pghoster.com with asmtp (Exim 4.24) id 1AceDM-0003QR-I5; Fri, 02 Jan 2004 23:20:45 -0600 Message-ID: <009001c3d1b9$51b2e7a0$1800053d@winxp> From: "Chris Travers" To: "Andy Lewis" , References: <002101c3d197$20082f20$0201a8c0@andy2> Subject: Re: sort by on two columns Date: Sat, 3 Jan 2004 11:05:17 +0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_008A_01C3D1E9.7841CFF0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - noon.pghoster.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - travelamericas.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=4.3 tagged_above=0.0 required=5.0 tests=BAYES_30, HTML_50_60, RCVD_IN_DSBL, RCVD_IN_NJABL, REFERENCES X-Spam-Level: **** X-Archive-Number: 200401/15 X-Sequence-Number: 16408 This is a multi-part message in MIME format. ------=_NextPart_000_008A_01C3D1E9.7841CFF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MessageSELECT * FROM customers ORDER BY last_name, first_name Works for me. ----- Original Message -----=20 From: Andy Lewis=20 To: pgsql-sql@postgresql.org=20 Sent: Saturday, January 03, 2004 8:15 AM Subject: [SQL] sort by on two columns Hi All, Is it possible to sort by two columns? Using the query below? SELECT table1.name, table2.name, FROM table1, ta= ble2 WHERE table1.id =3D table2.id ORDER BY I want to be able to sort the names select from two different tables and = two different colums(same data type). Is this possible? Thanks, Andy ------=_NextPart_000_008A_01C3D1E9.7841CFF0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message
SELECT * FROM customers ORDER BY last_name= ,=20 first_name
Works for me.
----- Original Message -----
Fro= m:=20 Andy Lew= is=20
To: pgsql-sql@postgresql.org
Sent: Saturday, January 03, 2004 8= :15=20 AM
Subject: [SQL] sort by on two=20 columns

Hi=20 All,
Is it p= ossible to=20 sort by two columns? Using the query below?
 
SELECT= =20 table1.name, table2.name, <other selected columns> FROM table1= ,=20 table2 WHERE table1.id =3D table2.id ORDER BY=20 <what?>
 
I want = to be able=20 to sort the names select from two different tables and two different=20 colums(same data type).
 
Is this= =20 possible?
 
Thanks,
 
Andy
------=_NextPart_000_008A_01C3D1E9.7841CFF0-- From aruth@intercation.com Sat Jan 3 04:34:03 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C2ABBD1BA81 for ; Sat, 3 Jan 2004 04:34:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 03722-10 for ; Sat, 3 Jan 2004 00:33:14 -0400 (AST) Received: from localhost.localdomain (unknown [166.70.154.50]) by svr1.postgresql.org (Postfix) with ESMTP id BC48BD1BCC6 for ; Sat, 3 Jan 2004 00:33:02 -0400 (AST) Received: from [127.0.0.1] (strongbad [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i034WqxL004960; Fri, 2 Jan 2004 21:32:53 -0700 In-Reply-To: <85E086DE-3D99-11D8-A298-000A95C88220@myrealbox.com> References: <003a01c3d1a5$0cb603d0$0201a8c0@andy2> <85E086DE-3D99-11D8-A298-000A95C88220@myrealbox.com> Mime-Version: 1.0 (Apple Message framework v609) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: "Andy Lewis" , From: Adam Ruth Subject: Re: sort by on two columns Date: Fri, 2 Jan 2004 21:32:51 -0700 To: Michael Glaesemann X-Mailer: Apple Mail (2.609) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/14 X-Sequence-Number: 16407 Sounds like you may want to concatenate the columns: ... order by table1.name || table2.name The sorting would then be performed on both of the them as though they were one column. Adam Ruth On Jan 2, 2004, at 8:04 PM, Michael Glaesemann wrote: > > On Jan 2, 2004, at 8:55 PM, Andy Lewis wrote: >> Yes, I understand this but, I would like to have the results of both >> "table1.name, table2.name" >> sorted as one column. >> >> Is this possible? > > So you want one column of name, including names from both table1 and > table2? In that case, you need to use UNION, I believe. If it's > something else, I'm not sure I understand what you're asking. Perhaps > you could include a sample of what you're getting, along with what > you'd like to see? > > Michael Glaesemann > grzm myrealbox com > > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings >