![]() |
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 |
bump 4 you
|
[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%'); |
..or
..WHERE CONCAT(name,title,comment) LIKE '%name%' |
Quote:
|
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? |
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