Fix seller filter options query
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m13s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m13s
This commit is contained in:
@@ -701,14 +701,18 @@ const getClientFilterOptions = async () => {
|
||||
ORDER BY value ASC;
|
||||
`),
|
||||
pool.query(`
|
||||
SELECT
|
||||
NULLIF(TRIM(id_vendedor), '') as id,
|
||||
NULLIF(TRIM(nome_vendedor), '') as name
|
||||
FROM orders
|
||||
WHERE (
|
||||
NULLIF(TRIM(id_vendedor), '') IS NOT NULL
|
||||
OR NULLIF(TRIM(nome_vendedor), '') IS NOT NULL
|
||||
)
|
||||
WITH seller_options AS (
|
||||
SELECT
|
||||
NULLIF(TRIM(id_vendedor), '') as id,
|
||||
NULLIF(TRIM(nome_vendedor), '') as name
|
||||
FROM orders
|
||||
WHERE (
|
||||
NULLIF(TRIM(id_vendedor), '') IS NOT NULL
|
||||
OR NULLIF(TRIM(nome_vendedor), '') IS NOT NULL
|
||||
)
|
||||
)
|
||||
SELECT id, name
|
||||
FROM seller_options
|
||||
GROUP BY id, name
|
||||
ORDER BY COALESCE(name, id) ASC, id ASC;
|
||||
`)
|
||||
|
||||
Reference in New Issue
Block a user