Re: Order by not working

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Order by not working
Date: 2021-02-16 22:11:02
Message-ID: ff1f0ae0-d505-6772-a18e-92f707419479@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 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, phone_list, email_list
>     FROM "household_data"
>     ORDER BY household_name
>     )
> TO '/tmp/household_data.csv'
> WITH (FORMAT CSV, HEADER);
>
> This works.
>
> Regards,
>
> Dan
>
>> On Feb 16, 2021, at 12:35 PM, David G. Johnston
>> <david(dot)g(dot)johnston(at)gmail(dot)com <mailto:david(dot)g(dot)johnston(at)gmail(dot)com>> wrote:
>>
>>
>> On Tuesday, February 16, 2021, Dan Nessett <dnessett(at)yahoo(dot)com
>> <mailto:dnessett(at)yahoo(dot)com>> 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 preference in pg_admin to guarantee this?
>>
>>
>> pgAdmin4 might be keying off of the presence of an index, which this
>> table doesn’t have.
>>
>> David J.
>

--
Angular momentum makes the world go 'round.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2021-02-16 22:42:56 Syntax checking DO blocks and ALTER TABLE statements?
Previous Message David G. Johnston 2021-02-16 21:02:04 Re: How to return a jsonb list of lists (with integers)