Jump to content

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


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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.