# How to only select rows with no children?

**URL:** <https://forums.swift.org/t/how-to-only-select-rows-with-no-children/69620>\
**Category:** Vapor\
**Tags:** fluent\
**Created:** [January 25, 2024, 7:14am UTC](https://forums.swift.org/t/how-to-only-select-rows-with-no-children/69620 "2024-01-25T07:14:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RussBaz](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/russbaz/32/30841_2.png) [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Post date:** [January 25, 2024, 7:14am UTC](https://forums.swift.org/t/how-to-only-select-rows-with-no-children/69620/1 "2024-01-25T07:14:30Z")

</div>

Hi. I have a model that can have children (one-to-many relationship to a different model) and I would like to find all rows that have no children. Is there a way to do it without writing raw SQL?

Thank you!

---

<div class="post-metadata">

**Author:** ![0xTim](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/0xtim/32/27968_2.png) [@0xTim](https://forums.swift.org/u/0xTim)\
**Post date:** [January 25, 2024, 10:54am UTC](https://forums.swift.org/t/how-to-only-select-rows-with-no-children/69620/2 "2024-01-25T10:54:36Z")

</div>

You might be able to use a `LEFT JOIN` to do this - see [Need SQL Query to find Parent records without child records - Stack Overflow](https://stackoverflow.com/a/6839529/1823705)
