Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xr5vH-00038R-Ob for pgsql-admin@arkaria.postgresql.org; Wed, 19 Nov 2014 14:07:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xr5vH-0005Nh-4H for pgsql-admin@arkaria.postgresql.org; Wed, 19 Nov 2014 14:07:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xr5vF-0005Na-V8 for pgsql-admin@postgresql.org; Wed, 19 Nov 2014 14:07:54 +0000 Received: from mail-qg0-x230.google.com ([2607:f8b0:400d:c04::230]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Xr5v8-0007oE-1k for pgsql-admin@postgresql.org; Wed, 19 Nov 2014 14:07:51 +0000 Received: by mail-qg0-f48.google.com with SMTP id q107so433787qgd.21 for ; Wed, 19 Nov 2014 06:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=1jY2rq8DhFQXhGAbr+WY1vGDzwhrG/E5LPo/Ho640QI=; b=M3sKvHHOQZxn95ljY163Gev5PPdbDJQggE36En6PFKjV8uymz9tD7GoywBG3pNqDju IBSNXFCy8gC/Dm9WcNsl8dDoxkhoygzBWo2u1I8EUOs2cu4Pr+kkzHEKqfdZLqwHX1vi M6PVkdoLfVdGuaR0L/IeFz2kIBxxNYLYNVMxWxMI5KQfFU2rF231RtlH/jaBBXw/FAyC BnybGBHHPUhT9bqR6x+aV4Ahk4XK6ddAus4kOLimqPnwgHmxvIEcsAfKYlqLzlJWTaYW lnEn4ZlXAxbmuzzcEhj9JzzwZeEtfW7GBAj7RIN7rUsNvFMhjsw1qFdPxYQiiEFhoMdY tB0w== X-Received: by 10.224.167.132 with SMTP id q4mr51172877qay.48.1416406064861; Wed, 19 Nov 2014 06:07:44 -0800 (PST) Received: from [192.168.254.4] (h77.89.102.166.static.ip.windstream.net. [166.102.89.77]) by mx.google.com with ESMTPSA id u46sm1621724qgd.3.2014.11.19.06.07.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 06:07:36 -0800 (PST) References: <546CA188.705@tech.sdb.it> Mime-Version: 1.0 (1.0) In-Reply-To: <546CA188.705@tech.sdb.it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: Cc: "pgsql-admin@postgresql.org" X-Mailer: iPad Mail (12B435) From: jayknowsunix@gmail.com Subject: Re: order by query wrong result Date: Wed, 19 Nov 2014 09:07:33 -0500 To: Silvio Brandani X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org That doesn't look like an error to me. The upper() function is only convert= ing your name field to upper case and then the "order by" is simply alphabe= tical based on that, which is what your return values are. What are you exp= ecting to get back? Your query probably needs adjusting. --Jay Sent from my iPad > On Nov 19, 2014, at 8:56 AM, Silvio Brandani wrote: >=20 >=20 > Hi all, >=20 > we have a query with wrong result in order by : >=20 > select * > from prova > where name ilike 'savino del bene s%' > and record_status =3D 'A' > order by upper(name); >=20 >=20 > and we get: >=20 >=20 > Savino Del Bene Santo Domingo > Savino Del Bene Singapore > Savino Del Bene Singapore - Airport Office > Savino Del Bene South Africa - Cape Town > Savino Del Bene South Africa - Durban > Savino Del Bene South Africa - Johannesburg > Savino Del Bene South Africa - Port Elizabeth > Savino Del Bene S.p.A. Campogalliano (MO) > Savino Del Bene S.p.A. Capodichino > Savino Del Bene S.p.A. Firenze > Savino Del Bene S.p.A. Genova > Savino Del Bene S.p.A. Headquarters > Savino Del Bene Spain S.L. - Alicante > Savino Del Bene Spain S.L. - Barcelona > Savino Del Bene Spain S.L. - Bilbao > Savino Del Bene Spain S.L. - Madrid > Savino Del Bene Spain S.L. - Palma de Mallorca > Savino Del Bene Spain S.L. - Valencia > Savino Del Bene Spain S.L. - Valencia Headquarter > Savino Del Bene Spain S.L. - Vigo > Savino Del Bene S.p.A. Livorno > Savino Del Bene S.p.A. Livorno ufficio Genova c/o Spedimar S.r.L. > Savino Del Bene S.p.A. Livorno ufficio La Spezia > Savino Del Bene S.p.A. Milano > Savino Del Bene S.p.A. Montecosaro Scalo > Savino Del Bene S.p.A. Montemurlo (PO) > Savino Del Bene S.p.A. Napoli > Savino Del Bene S.p.A. Osmannoro(FI) > Savino Del Bene S.p.A. Oste (PO) > Savino Del Bene S.p.A. Padova > Savino Del Bene S.p.A. Pietrasanta > Savino Del Bene S.p.A. Pisa > Savino Del Bene S.p.A. San Miniato > Savino Del Bene S.p.A. Torino > Savino Del Bene S.p.A. Treviso > Savino Del Bene S.p.A. Udine > Savino Del Bene S.p.A. Verona > Savino Del Bene S.p.A. Vicenza > Savino Del Bene Switzerland AG - Basel > Savino Del Bene Switzerland - Rancate >=20 >=20 > Each help higly appreciated, >=20 > Silvio Brandani >=20 >=20 > -------------------------------------------------------------------------= ------- >=20 >=20 >=20 > This message is for the recipients only. If you receive it in error, plea= se notify the sender and delete it together with any attachments. For any f= urther information, including our privacy policy please refer to http://www= .savinodelbene.com/privacy/ >=20 >=20 >=20 > -------------------------------------------------------------------------= ------- >=20 >=20 > --=20 > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin