SupabaseS
Supabase4y ago
hko

Limit on foreign table to filter select query?

Hi,

I'm a bit stuck trying using limit/order on foreign tables:
const { data, error } = await client
  .from("user_content_queue")
  .select(
    "title, content, type, target_url, format, priority, id, published_at, digest_id (id, created_at)"
  )
  .order("created_at", { foreignTable: "digest_id", ascending: false })
  .limit(1, { foreignTable: "digest_id" })
  .order("type", { ascending: false })
  .order("priority", { ascending: true });


Multiple pieces of content belong to a single digest. With this query, I want to retrieve all content items that belong to the latest query. While the query runs without any errors, it does not limit the digests to the latest id, but rather returns all digests.

Any ideas on how I might get this to work?
Was this page helpful?