Convert search from SQL Server to MySQL
- by HAJJAJ
hi, everyone.
i need to convert this one from SQL Server into MySQL
IF IsNull(@SearchText, '') <> '' BEGIN
SET @SearchText = '%' + @SearchText + '%'
SELECT NewsID,DeptID,DeptName,Title,Details ,NewsDate,img
FROM @tbSearchtextTb
WHERE IsNull(Title,'')+IsNull(Details,'') LIKE @SearchText END
this code will search fro my search word in this columns: Title, Details.
i tried to convert this line but i had lots of errors:
these are my unsuccessful attempts
IF ISNULL(SearchText,'') <> '' THEN
SELECT CatID,CatTitle,CatDescription,CatTitleAr,CatDescriptionAr,PictureID,Published,DisplayOrder,CreatedOn
FROM tmp
WHERE CatTitle + CatDescription + CatTitleAr + CatDescriptionAr
LIKE $SearchText;
and this one
IF $SearchText IS NOT NULL THEN
SELECT CatID,CatTitle,CatDescription,CatTitleAr,CatDescriptionAr,PictureID,Published,DisplayOrder,CreatedOn
FROM tmp
WHERE ISNULL(CatTitle,'') +ISNULL(CatDescription ,'') +ISNULL(CatTitleAr ,'') +ISNULL(CatDescriptionAr,'') LIKE $SearchText;
and many many other ways but i could not find any.
so if you know please let me know, thanks and best regards.