Solved

How to create this SQL Query?

Posted on 2009-04-09
4
212 Views
Last Modified: 2012-05-06
Hi Folks,

I want to Query the database (3 fields)  and find all matches for a particular word. I want to search both the name, website and the category field for this word.

Example:

If I query for the word jenna it shoudl return all records of which either the name, website or category contains the word jenna.

If you need more info please ask. Im using phpMyAdmin

Regards Dweep

Ps a next step will be to convert this into php code and use a textbox so the user can search the database for whatever word he wants and get the results displayed.
SELECT *
FROM `adressen`
WHERE `name` = "jenna"

Open in new window

0
Comment
Question by:PeterdeB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:twocandles
ID: 24105935
try this:


SELECT *
FROM `adressen`
WHERE `name` like "jenna"
or 'website' like "jenna"
or 'category' like "jenna"

Open in new window

0
 
LVL 14

Accepted Solution

by:
shobinsun earned 500 total points
ID: 24106024
Hello,

use:

SELECT * FROM `adressen` WHERE `name` like "%jenna%" or 'website' like "%jenna%" or category' like "%jenna%"

Its more correct.

Regards.
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24106039
0
 

Author Closing Comment

by:PeterdeB
ID: 31568457
Exactly what I asked for thanks a lot! Some more questions will follow regarding this project.

Paul
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL trigger 5 49
Syntax issue with my Where Clause SQL 2012 20 42
Does INTERSECT return opposite from FULL OUTER JOIN? 4 38
Access 2003, find all instances of database ODBC 3 42
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question