Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program which show reports of students i habe multipile dropdown lists in my page and what the supervisor do is selecting what he wants to show first " for example students who live in usa " /ps i have multi dropdown lists /then my program show him all records in database of these filters .. but my query is not working what i do is

"Select * from students as s where" +"(" + address.length ==0+"||" +address.includes('s.adr') "

Notes ; Address.length ==0 because i want to all the records in case of the supervisor did not choose country and and wanted all countries in th DB ,,,,

Also note that addres is array containig all the countries that supervisor choose

What i am doing wrong here and how can i correct it or how i can do this in other ways

Thanksss

What I have tried:

"Select * from students as s where" +"(" + address.length ==0+"||" +address.includes('s.adr') "
Posted
Updated 6-Oct-21 3:38am
Comments
Bob@work 7-Oct-21 16:26pm    
Not positive about nodejs syntax, but a standard SQL statement should be more like:

SELECT * FROM students where LENGTH(address) = 0 OR address LIKE '%s.adr%'

That returns rows with empty address entries and address entries containing the text "s.adr" anywhere in the value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900