How to join for where clause but not select a table

I’m trying to do a join on a table so that I can filter records but not actually selecting from that table. Here’s the example where it’s still selecting from the joined table. I assume you can manually specify the select using tuples but is there a way to do this using a Queryable struct instead?

  let (existing_excerpt, _) = source_items::table
    .first::<(SourceItem, Source)>(&db.0)

Any advice? Thanks.

Just use a explicit select clause to specify which columns you want to select. Those need to match your struct that implements Queryable. If you want to select all columns of a given table you can do something like .select((sources::column_a, sources_column_b, …)) or .select(sources::all_columns)

1 Like