© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
20 replies
༺ ╲⎝ζ͜͡Lukyrouge⎠╱༻

How can I query this

I want to query all the items that have an active Listing (not cancelled and sold_quantity < quantity) as an object that look like this
type Item = {
  id: number;
  name: string;
  (all item attributes)
  listings: {
    id: number;
    user_id: string;
    quantity: number;
    price: number;
    price_item?: {(all item attributes)};
    sold_quantity: number;
    cancelled: boolean;
    created_at: Date;
  }[]
type Item = {
  id: number;
  name: string;
  (all item attributes)
  listings: {
    id: number;
    user_id: string;
    quantity: number;
    price: number;
    price_item?: {(all item attributes)};
    sold_quantity: number;
    cancelled: boolean;
    created_at: Date;
  }[]

Is that possible using supabase to do it in only 1 query or do I have to do multiple queries ?
image.png
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How can I turn this SQL into Supabase-js query?
SupabaseSSupabase / help-and-questions
4y ago
Can this query be written in Supabase?
SupabaseSSupabase / help-and-questions
4y ago
How can I achieve this with RLS?
SupabaseSSupabase / help-and-questions
7mo ago
How do I query JSON ?
SupabaseSSupabase / help-and-questions
4y ago