This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SQL question
#1
Hi

I am doing some quries to the database to be able to find some objects depending on different values. I have been able to find it, but I want some help to understand why things are as they are.

The code I was trying to use was:
Code:
newNavn = db:getall('SELECT name FROM objects WHERE name LIKE ? AND name LIKE ?', origObjKode, term )

This returned an empty table. 

I then changed the code to 
Code:
newNavn = db:getall('SELECT name FROM objects WHERE name LIKE "%'.. origObjKode ..'%" AND name LIKE "%'.. term ..'%"')
This returned a table with the information I wanted. 

I have used the structure from the first example before, and it has worked, but now it did not. Why is it so? 

I am sure I have done something wrong in the first example, I just do not understand what it is.
There are 10 kinds of people in the world; those who can read binary and those who don't  Cool
Reply


Messages In This Thread
SQL question - by Trond Hoyem - 05.02.2021, 07:39
RE: SQL question - by admin - 05.02.2021, 07:46
RE: SQL question - by Trond Hoyem - 05.02.2021, 07:54
RE: SQL question - by admin - 05.02.2021, 12:57
RE: SQL question - by Trond Hoyem - 05.02.2021, 13:33
RE: SQL question - by admin - 05.02.2021, 15:18

Forum Jump: