Skip to content
Advertisement

Using one query to look up multiple tables with one input

the query is at line 103 This is the query I used (on Visual Studio Code)2I have a problem and I’ll try to explain it. We have to create a functioning website for one of my classes, and one of the tasks is : create an “input box” where the input can correspond to two different values (either “Kategorie” or “Description”) and then once you click the search-button you have a table with all the information needed. I tried something like : “SELECT … FROM… WHERE kategorie=? OR description=? AND… but it says that there is an syntax error… Could anybody help me out?

Advertisement

Answer

You may have missed single quotes for kategorie and description values. Try something like this:

SELECT * FROM tab1 WHERE (kategorie='kat1' OR description='descr1') AND other='other value'
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement