Re: Bug in my ( newbie ) mind?

Tod McQuillin <devin@spamcop.net>

From: Tod McQuillin <devin@spamcop.net>
To: Christopher Sawtell <csawtell@xtra.co.nz>
Cc: PostgreSQL-General <pgsql-general@postgresql.org>
Date: 2001-02-21T05:34:31Z
Lists: pgsql-general
On Wed, 21 Feb 2001, Christopher Sawtell wrote:

> chris=# select phone_prefix.prefix order by random() limit 1 || '-' ||
> lpad((random()*10000)::int, 4, '0')::text as "Phone Number";

All the things you are selecting need to come in the first part of the
query.

like,

SELECT prefix || '-' || lpad((random()*10000)::int, 4, '0')::text as
"Phone Number" from phone_prefix order by random() limit 1;
-- 
Tod McQuillin