Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

3
Odd Join Help
Post Flair (click to view more posts with a particular flair)
Post Body

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?

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
2,476
Link Karma
293
Comment Karma
2,158
Profile updated: 2 hours ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago