Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL query
Message
From
15/02/2019 13:27:40
 
 
To
15/02/2019 13:00:54
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01666437
Message ID:
01666455
Views:
94
This message has been marked as the solution to the initial question of the thread.
>Muito obrigado, Antonio!
>I confess that I gave a sloppy description of the problem.
>Please ignore the second column (Bore).
>I am looking for the largest difference of depth in two consecutive records. I recieve these data from a measuring device potentially in more than one csv files which I append into that table. Primarily the raw data are not even sorted by depth, so first of all I may have to "translate" these data into an ordered table with an additive column "Position" and then perform your suggestion with the modification of joining the table against itself on D1.position = D2.position +1. (see new attachment)
>Would you agree with that?
>
>Best regards

Eugen,

If I got your requirements right, and since your concept of "consecutive records" seems based on depth values, you may skip the depth ordering and record positioning steps and query the source directly as it comes after being concatenated:
SELECT TOP 1 ABS(D1.Depth - D2.Depth) AS DepthDifference, D1.Depth, D2.Depth ;
	FROM csvData D1 ;
		INNER JOIN csvData D2 ON D2.Depth > D1.Depth ;
	WHERE D2.Depth = (SELECT MIN(Dt.Depth) FROM csvData Dt WHERE Dt.Depth > D1.Depth) ;
	ORDER BY 1 DESC
This will return 0.190 between depths 5.560 and 5.570.
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform