Click to See Complete Forum and Search --> : sql querry where a = substring b


Mr Tuition
01-23-2008, 04:16 PM
hi, I have a querry php/sql (and Im a bit of an sql noob)

$data = mysql_query("
SELECT Name, Summ, title, URL, Location, Subject, ImgHeight, ImgWidth,
MATCH(Name, Summ, title, Location, Subject)
AGAINST ('$srch' IN BOOLEAN MODE) AS score FROM Users
WHERE MATCH(Name, Summ, title, lDescription, Location, Subject)
AGAINST ('$srch' IN BOOLEAN MODE)
ORDER BY score DESC LIMIT 20
")
or die(mysql_error());
}

how can I now refine $data further, to only contain results where a column (_postcode) from another table (which also conatins 'Name') starts with OX

Mr Tuition
01-23-2008, 05:11 PM
please delete the above, it doesnt even make sense to me!

Mr Tuition
01-23-2008, 06:01 PM
it something like this I need to do, but the below doesnt work:
(mysql version 4.1.22 )
$data = mysql_query("
SELECT _Users._Name, _Users._Summ, _Users._title, _Users._URL, _Users._Location, _Users._Subject, _Users._ImgHeight, _Users._ImgWidth, _Props.Postcode,
MATCH(_Users._Name, _Users._Summ, _Users._title, _Users._Location, _Users._Subject)
AGAINST ('$srch' IN BOOLEAN MODE) AS score FROM _Users, _Props
WHERE MATCH(_Users._Name, _Users._Summ, _Users._title, _Users._Description, _Users._Location, _Users._Subject)
AGAINST ('$srch' IN BOOLEAN MODE)
AND _Props.Postcode = 'OX ...' WHERE _Props._Name = _Users._Name
ORDER BY score DESC LIMIT 20

")