Jump to content

need help with like in where clause using variable from a second table


security_man

Recommended Posts

to me this looks logical, but obviously the like operator is the problem, i just dont know how to write it correctly, any help?

 

i get the following error: #1054 - Unknown column '%tblhosting.domain%' in 'where clause'

 

yes the columns and tables are correct - i just didnt think you wanted to look at my enter table structure :)

 

SELECT * FROM `tblinvoiceitems`, `tblhosting` WHERE tblinvoiceitems.description LIKE `%tblhosting.domain%`

Wrong quotes. Backticks are for names of objects in the database (databases, tables, fields, etc.) while single- and double-quotes are for strings.

LIKE "%tblhosting.domain%"

 

But you don't want strings. How is this search supposed to work? Find all invoice items that have a description containing any hosting domain?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.