Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Self Join
Message
From
02/07/2001 04:30:14
 
 
To
01/07/2001 22:14:33
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00525741
Message ID:
00525772
Views:
17
Hi!

In VFP join condition could contain any logical expression. And you can use correlated query (could be slow) You query will probably look like following:
Select a.empl_no, a.WEF, a.Salary, b.Salary as OldSalary, max ;
  from empSalary a ;
  left join empSalary b ;
     on a.empl_no = b.empl_no AND b.WEF<a.WEF
  where b.WEF in (select max(c.WEF) from empSalary c where a.empl_no = c.empl_no AND c.WEF<a.WEF)
HTH.


>Hi all VFP users/experts
>
>I have a table as follows of employees salary data
>
>empl_no  WEF         Salary
>0001     01/01/1998  2000
>0001     01/01/1999  2500
>0001     01/01/2000  3000
>0001     01/02/2001  3200
>
>How can I construct a SQL to generate follwing cursor
>
>empl_no  WEF         New Salary     Old Salary
>0001     01/01/1998  2000           NULL
>0001     01/01/1999  2500           2000
>0001     01/01/2000  3000           2500
>0001     01/01/2001  3200           3000
>
>Would appreciate all help. Thanks
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform