Re: Order by not working

2021-02-19 Thread Peter J. Holzer
On 2021-02-17 08:45:05 +0100, Laurenz Albe wrote: > On Tue, 2021-02-16 at 16:11 -0600, Ron wrote: > > SQL is only intuitive to people who've done programming... :) > > SQL is quite counter-intuitive to people who have only done > procedural programming. Yes, different paradigm. SQL is more like

Re: Order by not working

2021-02-16 Thread Laurenz Albe
On Tue, 2021-02-16 at 16:11 -0600, Ron wrote: > SQL is only intuitive to people who've done programming... :) SQL is quite counter-intuitive to people who have only done procedural programming. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com

Re: Order by not working

2021-02-16 Thread Ron
SQL is only intuitive to people who've done programming... :) Also, since your table names are only composed of lower case and underscores, the double quotes are not needed. On 2/16/21 1:41 PM, Dan Nessett wrote: Thanks to those who responded. I have solved my problem by noting the advice to

Re: Order by not working

2021-02-16 Thread Dan Nessett
Thanks to those who responded. I have solved my problem by noting the advice to use a select with order by. In particular, I need to export the data to a csv file anyway, so I use the following copy command: COPY (SELECT household_name, family_list, street_address, city, state, zip,

Re: Order by not working

2021-02-16 Thread David G. Johnston
On Tuesday, February 16, 2021, Dan Nessett wrote: > Thanks Peter. The listing of the result is from pg-admin 4.30 using > view/edit data applied to the household_data table. In the past this has > always returned the table contents in the ORDR BY sort order. Do I need to > specify some

Re: Order by not working

2021-02-16 Thread Dan Nessett
Thanks, Dan > On Feb 16, 2021, at 12:11 PM, Ron wrote: > > What would you tell pgadmin? "Order this particular query -- out of all the > billion queries I might write -- in this particular manner?" > > No, that's not how things work. Just add an ORDER BY when you query the > table. > >

Re: Order by not working

2021-02-16 Thread Ron
What would you tell pgadmin?  "Order *this* *particular* query -- out of all the billion queries I might write -- in *this particular* manner?" No, that's not how things work.  Just add an ORDER BY when you query the table. On 2/16/21 12:48 PM, Dan Nessett wrote: Thanks Peter. The listing of

Re: Order by not working

2021-02-16 Thread Dan Nessett
Thanks Peter. The listing of the result is from pg-admin 4.30 using view/edit data applied to the household_data table. In the past this has always returned the table contents in the ORDR BY sort order. Do I need to specify some preference in pg_admin to guarantee this? Dan > On Feb 16, 2021,

Re: Order by not working

2021-02-16 Thread Peter Coppens
Not sure how you select the household > > The result is (only the first column is shown): > > household_name > > "Garcia" > "Armstrong" > "Armstrong" > "Bauer" > "Bauer" > "Berst" > "Berst" > "Minch ()" > "Berst" > “Besel” but unless you select from the resulting table using again an

Order by not working

2021-02-16 Thread Dan Nessett
Hello, I am using "PostgreSQL 9.6.5 on x86_64-apple-darwin, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00), 64-bit" I am having trouble with a create select statement’s order by clause. The input table,

Re: order by not working in view ?

2020-04-09 Thread David G. Johnston
On Thursday, April 9, 2020, David Gauthier wrote: > psql (9.6.7, server 11.3) on linux > > In the copy/paste below, first 2 lines returned by a select on the view, > why didn't it sort on start_datetime correctly ? I would think that the > one started on 04-08 would come before the one on 04-09

Re: order by not working in view ?

2020-04-09 Thread Tom Lane
David Gauthier writes: > In the copy/paste below, first 2 lines returned by a select on the view, > why didn't it sort on start_datetime correctly ? Putting an ORDER BY in a view is a bit dangerous (last I looked, it wasn't even legal in standard SQL). Yeah, the view will sort, but there is

order by not working in view ?

2020-04-09 Thread David Gauthier
psql (9.6.7, server 11.3) on linux In the copy/paste below, first 2 lines returned by a select on the view, why didn't it sort on start_datetime correctly ? I would think that the one started on 04-08 would come before the one on 04-09 ? dvdb=> \d sim_phases; Table