vulkan vulkan - 5 months ago 9
SQL Question

How to search with LIKE in columns merged with AS

I merged two column with AS , now I want to search data inside them with LIKE. How can i do that
*I using PHP

Php :

$sql = "SELECT CONCAT (name , ' ' , surname) AS full FROM person ";
$query = mysqli_query($con,$sql);
echo "<p>$row[full]</p>";
echo mysqli_error($con);


I think you could try like this - using the having clause rather than where

select concat( field1, field2 ) as 'alias'
from `table`
having `alias` like '%word%'

or, in your case:

SELECT CONCAT (`name` , ' ' , `surname`) AS 'full'  FROM `person`
having `full` like '%word%';