Skip to content

Select with multiple conditions and AND does not work with postgresql #2711

@Mamath93

Description

@Mamath93
var query = {
	text: 'SELECT * FROM advertisement WHERE (brand_class = ($1) AND product_class = ($2)) ',
	values: [brand_class,product_class]
};

    const client = await pool.connect();
    const res = await client.query(query);

I does not work with pg, but it works by directly querying postgresql.:
SELECT * FROM advertisement WHERE (brand_class ='body_cosmetic' AND product_class ='skin_tone');

This one works:
var query = {
text: 'SELECT * FROM advertisement WHERE product_class =($1)',
values: product_class
};

But AND or other operator is not well handled by pg....

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions