Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to create this SQL Query?

Posted on 2009-04-09
4
Medium Priority
?
222 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 2000 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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 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