Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with ORDER on an SQL giving wierd error
Message
From
15/09/1999 13:54:43
 
 
To
15/09/1999 13:48:03
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00265100
Message ID:
00265107
Views:
16
I have had similar problems. My fix is to use padl(code.codenum, 10) to make the number correct. For the order by clause, I think you need to reference a field in the final select, functions and such are nono's. Try changing your trim(code.codenum) into padl(code.codenum,10) and then order by 2, 3, 4

good luck!

>I have a select statement that is producing an error that after TOOOO many hours was able to figure out WHAT was causing but not sure why...
>
>Here is the statement as I had it written....
>
>Select client.clientnum, client.clientname, ;
> Trim(code.codenum)+" "+code.codedesc as code, ;
> Trim(employee.lastname)+", "+employee.firstname as employee, ;
> log.logdate, ;
> log.time, ;
> log.rate, ;
> log.time*log.rate as amount ;
> from Timepro!log left join timepro!employee on log.employeeid = employee.employeeid ;
> inner join timepro!code on log.codeid = code.codeid ;
> inner join timepro!client on log.clientid = client.clientid ;
> where log.firmid=gFirmid and log.logdate>=gStartdate and log.logdate<=gEnddate and log.employeeid<>0 ;
> into cursor curswip ;
> order by client.clientname, val(code.codenum),employee
>
>
>The error I was getting is
> SQL ERROR: Column CLIENTNAME is not found
>
>
>After extensive trial an error, if I remove the VAL() from around the field CODE.CODENUM the error disappears - now just the sorting order is wrong (10,15,1000,1100,20,2000,30,40 instead of 10,15,20,30,40,1000,1100,2000). I most likely will be switching the field for CODE.CODENUM to a numeric instead of a text but shouldn't my SELECT statement have worked and what does that have to do with CLIENTNAME. I spent so much time trying to figure out why CLIENTNAME was messing up
--Todd Sherman
-Wake Up! Smell the Coffee!
Previous
Reply
Map
View

Click here to load this message in the networking platform