GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   need help with a MySQL query! (https://gfy.com/showthread.php?t=970593)

lost&found 05-27-2010 10:52 PM

need help with a MySQL query!
 
OK so lets say you have a table with 6 columns and you want to query with a pattern match on 4 columns. How do I do this?

I can produce accurate result with 1 column like this:

SELECT * FROM tableName WHERE name LIKE '%pattern%'

That works with one column like 'name' but if I wanted to query other columns like name,title,comment,ect how would I form this SQL statement?

details:

MySQL 5.0.77
Al cols are Latin_general_ci

Ya I am a newbie with this stuff.....

:thumbsup

LoveSandra 05-28-2010 01:19 AM

bump 4 you

Spankys Teens 05-28-2010 07:46 AM

[QUOTE=lost&found;17182590]

SELECT * FROM Name WHERE name LIKE '%pattern%'

That works with one column like 'name' but if I wanted to query other columns like name,title,comment,ect how would I form this SQL statement?

Try this:

SELECT Name, FROM table
WHERE CONTAINS((COLUMN NAME 1, COLUMN NAME 2), '%pattern%');

mikke 05-28-2010 11:20 AM

..or

..WHERE CONCAT(name,title,comment) LIKE '%name%'

Spankys Teens 05-28-2010 10:28 PM

Quote:

Originally Posted by mikke (Post 17184334)
..or

..WHERE CONCAT(name,title,comment) LIKE '%name%'

I forgot about CONCAT :thumbsup:thumbsup:thumbsup....it's been a few years since i used SQL

fatfoo 06-09-2010 11:42 AM

Good luck with MySQL.

I would love to believe that you are the sexy woman in your avatar.

Look! You can be multiplied by 2!

http://www.gofuckyourself.com/image....ine=1266735947http://www.gofuckyourself.com/image....ine=1266735947

What part of Canada are you from?

lost&found 06-10-2010 12:00 PM

BC and I am the girl in my avatar!


All times are GMT -7. The time now is 09:50 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc