I have two tables like so
Table A: Filename: (12345678_123456) Age: (100)
Table B: Filename: (12345678_123456) ID: (501)
I have the following query
SELECT B.Filename, A.Age, B.ID FROM DB.A INNER JOIN B ON B.Filename WHERE B.ID >=0 AND B.ID <=100 LIMIT 100;
There are two problems. The first is that when it gets to an ID of 6,240 the ID and Filename wrap back around and then repeats the same ID and filenames for another iteration of 6,240 ID's. The second problem is that each iteration of 6,240 ID's, the age is staying exactly the same. I'm a beginner at SQL and this is getting me rather frustrated. If anyone could point out my (probably obvious) mistake(s), it would be highly appreciated.
This is your query:
SELECT B.Filename, A.Age, B.ID
FROM DB.A INNER JOIN
B
ON B.Filename
WHERE B.ID >=0 AND B.ID <=100
LIMIT 100;
It doesn't make sense, especially the on
clause. I might guess that you mean:
SELECT B.Filename, A.Age, B.ID
FROM DB.A INNER JOIN
B
ON B.Filename = A.FileName
WHERE B.ID >=0 AND B.ID <=100
LIMIT 100;