[SOLVED] Grabbing List Collection data for a query

Hello All. I have a list collection that is pulling from a table, pretty simple. However, this table has IDs of data from other tables that I need to query and show in the list.

For example, the list has entry of a horse with ID 10001. I need to get the name of that horse. The name of the horses is in a separate table from this query. Is it possible to dynamically grab the name table data in the list's Title field? In other words, is it possible to pass parameters into a query?

Perhaps I'm doing this incorrectly and there is an easier way, if so please let me know.

Hi @mattcodes, welcome to the community! :wave:

Why are you not using a JOIN on this one and you can combine the two tables in this query and only specifying the name and the barnname of the horse?
i.e:

SELECT
  f.barnname,
  h.name as horse_name
FROM foaltime_h f
JOIN horse h ON h.id = f.hid
WHERE hid = {{getItems.data.hid}}

You can add other properties from those tables in your query as you see fit.

1 Like

Exactly what I needed, some extra SQL magic. Thank you @jocen !

1 Like