?
Solved

How to create this SQL Query?

Posted on 2009-04-09
4
Medium Priority
?
218 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

801 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