Skip to main content
Participating Frequently
November 8, 2012
Question

Like operator

  • November 8, 2012
  • 2 replies
  • 953 views

Hello everyone

I'm having trouble using like operator

In my database I have three fields called

cadastro_seguimento

cadastro_contato

cadastro_empresa

they are all type text

I'm using dreamweaver, and I wonder how do I use to look like in these 3 fields.

Below is the example of my query

SELECT *

FROM register

WHERE colname = cadastro_categoria_id cadastro_empresa OR LIKE% search%

But my query besides using the like, I will also do a search for ID.

This topic has been closed for replies.

2 replies

Participating Frequently
November 9, 2012

SQL operators are used to test conditions by comparing columns and values, so you must always supply each on either side of the operator. As Rob mentioned, your SQL syntax is completely wrong. You can't simply guess, you need to follow a precise syntax. If you are not familiar with SQL syntax, be sure to check your SQL reference manual for your DBMS.

Here's an example:

SELECT *

FROM register

WHERE cadastro_seguimento = "test" OR cadastro_empresa LIKE "%test%"

Participating Frequently
November 26, 2012

Hello to all the forum

My need is I have a jump menu with options to sort the data, what I want to do is that when I click on this menu option to do it as the sort of data that I choose from the menu.

So I want to know if I can do this already with recordeset I made in dreamweaver

Rodrigo Vieira Eufrasio da Silva

rodrigo.mct@gmail.com

Participating Frequently
November 26, 2012

>My need is I have a jump menu with options to sort the data,

Sorry, I don't understand. What does the LIKE operator have to do with sorting? The LIKE operator is used to filter the recordset. You use the ORDER BY clause to sort the recordset.  Please provide more details.

Rob Hecker2
Legend
November 8, 2012

use AND instead of OR

Just to make sure you understand, this has nothing to do with dreamweaver or PHP, this is SQL.

Also, I am assuming that the way you have shown us your query is just for simplicity, because that would never work as a query. Computer code is all about precision, so if you want precise answers, give precise details about the issue.