Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with MAX() in SELECT
Message
 
 
To
24/01/2002 14:41:44
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Contracts, agreements and general business
Miscellaneous
Thread ID:
00608962
Message ID:
00610061
Views:
21
This message has been marked as a message which has helped to the initial question of the thread.
If you can add 'X' to your ref_Table than following should work.
SELECT;
 Work_Table.Code, MAX(Ref_Table.Code) as max_code;
 FROM Work_Table ;
 JOIN Ref_Table ;
 ON Work_Table.Code = STRTRAN(Ref_Table.Code, " ", "") ;
 	OR "X" = STRTRAN(Ref_Table.Code, " ", "") ;
 GROUP BY 1 ;
 INTO CURSOR temp1
I'll look into the rest of your post later.


>Hi Sergey,
>I've used this to step thing.
>But after a while a remembered that I need to set the ones not referenced in the table with the max() to a default value.
>
>I in my stupidity remebered on OUTER JOIN condition and NVL() doing something like
>
>*Say 'X' is a default
>
>SELECT;
> Work_Table.Code, <b>NVL(</b>MAX(Ref_Table.Code)<b>,'X')</b> as max_code;
> FROM Work_Table ;
> <b>LEFT OUTER</b> JOIN Ref_Table ;
> ON Work_Table.Code = STRTRAN(Ref_Table.Code, " ", "") ;
> GROUP BY 1 ;
> INTO CURSOR temp1
>
>This gives me the pour nonsense.
>
< snip >
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform