I'm trying to select specific values in an Access database. So the database contains many colums, I'm only able to select the first values, or last:
SELECT Column1, First(Column7) AS Column7_1, First(Column8) AS FirstOfColumn8, [Column1] & [Column7_1] AS [Column1&Column7]
FROM [Table1]
GROUP BY Column1;
Now what I'm trying to figure out is how to get the nth values in those columns. What would be perfect is if SQL would recognize third(Column7)... I tried the following:
SELECT Column1, First(Column7) AS Column7_1, First(Column8) AS FirstOfColumn8, [Column1] & [Column7_1] AS [Column1&Column7]
FROM [Table1]
WHERE Column7 > (SELECT First(Column7) FROM [Table1]) AND Column8 > SELECT First(Column8) FROM [Table1])
GROUP BY Column1;
But this is not getting me there. the values from the different columns do not correspond anymore. Any guess on how I could get this? Thanks
AFAIK, selecting a column by column number with the aforementioned syntax is not really supported with SQL.
Something similar to the following could do the trick (with dynamic SQL):
*The below query could be of use!