OR query for relationship table #3828
-
i need to know how to apply (or like) for 2 columns in relationshipi'm fetching let query = supabase
.from("jobs")
.select(
`
*,
custFilter:customers!inner(),
customers:customers(first_name, last_name)
`,
{ count: "exact" }
)
.range(offset, offset + pageSize - 1);
// Add search filter
if (searchQuery) {
const isNumber = !isNaN(Number(searchQuery));
if (isNumber) {
//this is because like operator not working with integer columns
query = query.filter("id", "eq", Number(searchQuery));
} else {
query = query
.or(`custFilter.first_name.ilike%${searchQuery}%,custFilter.last_name.ilike%${searchQuery}%`)
.or(
`custFilter.not.is.null`
);
}
} error {
"code": "PGRST100",
"details": "unexpected \"f\" expecting \"not\" or operator (eq, gt, ...)",
"hint": null,
"message": "\"failed to parse logic tree ((custFilter.first_name.ilike%rob%,custFilter.last_name.ilike%rob%))\" (line 1, column 15)"
} |
Beta Was this translation helpful? Give feedback.
Answered by
wolfgangwalther
Dec 21, 2024
Replies: 2 comments 5 replies
-
@laurenceisla pls can you support ? |
Beta Was this translation helpful? Give feedback.
3 replies
-
Two problems with that:
Thus: |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
SherifMega
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two problems with that:
*
instead as mentioned in the docs.or
you need to replace=
with.
. See examples in the docs.Thus:
custFilter.first_name.ilike.*rob*
should work better.