Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Leonard Trevor
  Where is Leonard Trevor?
 Edinburgh
 United Kingdom
 Leonard Trevor
Subject: RE: ORDERING PROBLEM
Thread ID: 174646 Message ID: 174737 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Saturday, May 24, 2008 10:04:32 AM         
   



> Pls assist
>
> I'm trying to order the following select statement but it gives an error message
>
>
>
SELECT * FROM vpayroll;
>    WHERE  (STR(vpayroll.YEAR1,4,0)+RIGHT('00'+LTRIM(STR(vpayroll.PERIOD,2,0)),2)>=XSMALL ;
> 	.AND. STR(vpayroll.YEAR1,4,0)+RIGHT('00'+LTRIM(STR(vpayroll.PERIOD,2,0)),2) <=XLARGE);
> 	ORDER BY STR(vpayroll.YEAR1,4,0)+RIGHT('00'+LTRIM(STR(vpayroll.PERIOD,2,0)),2);
> 	INTO CURSOR GPAYROLL

>
> Please assist

SELECT * FROM Vpayroll WHERE PADL(year,4)+'00'+PADL(period,2) ;
 BETWEEN M.xsmall AND M.xlarge ORDER BY <column ordinal cnumber(s)>

You can't order by expressions in VFP, only by column names or numbers. The numbers refer to the position of the column list in the query; the names can refer to the actual name or the column alias.

-Anders

ENTIRE THREAD

ORDERING PROBLEM Posted by Leonard Trevor @ 5/24/2008 7:25:26 AM
RE: ORDERING PROBLEM Posted by Boudewijn Lutgerink @ 5/24/2008 7:40:43 AM
RE: ORDERING PROBLEM Posted by tushar @ 5/24/2008 7:45:14 AM
RE: ORDERING PROBLEM Posted by Anders Altberg @ 5/24/2008 10:04:32 AM
RE: ORDERING PROBLEM Posted by Samir Ibrahim @ 5/24/2008 3:10:11 PM
RE: ORDERING PROBLEM Posted by Anders Altberg @ 5/24/2008 4:06:45 PM
RE: ORDERING PROBLEM Posted by Samir Ibrahim @ 5/24/2008 4:18:02 PM