Hi eksantrik,
Might you happened to have seen my post in this thread: https://forum.infiniteautomation.com/topic/3115/sql-data-source-query/2
It may have some relevant information / inspiration.
The connection between the SQL points is the 'column name' on the point. If 'Row-based query' is not checked on your data source, then the point will get the value in the value column if its column name matches the ID column. If you are doing a row-based query, then it's the first selected column contains the identifier.