Search code examples
supabasesupabase-database

How to do custom query in supabase postgresql?


How to do this query with supabase postgreSQL ?

SELECT Words.word, COUNT(audios.id) AS count
FROM Words 
LEFT OUTER JOIN audios ON audios.word_id = words.id
GROUP BY words.id ORDER BY count DESC;

Solution

  • You would create a Postgres function and then call it with the .rpc method of the supabase-js library. You can read more about this in the documentation.