This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
DB: mysql Ver 15.1 Distrib 10.3.37-MariaDB
I have a query that I'm struggling with. Hope I can find some answers here.
I have two tables
first_names (linenumber; name) and last_names(linenumber; name)
These names were extracted from a file and the linenumber tells me the line number from the file where the value came from.
e.g.
first_names (1, John) & last_names(3,Doe)
first_names(17,Jane) & last_names(23,Doe)
So I'm trying to pair the first name with the correct last name. The difference in the two line numbers is not consistent so something like join on last_name.linenumber = first_name.linenumber 2 is not going to work. What I do know is that the linenumber for the first_name will always be the MAX(first_name.linenumber) that is less than the last_name.linenumber.
So looking at the examples above. There is
no first_name.linenumber = 2. There is no first_name.linenumber between 18 and 22.
Any suggestions or ideas?
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/SQL/comment...