Take a look at these two queries.
first:
SELECT IF(u.lastname IS NULL,b.comp_name,CONCAT(u.name, " ", u.lastname)) AS name,u.user_ID,t.user_type,b.sched_entered
FROM users u
join business_users b on u.user_id=b.crid
join buz_usertype t on b.bus_user_type=t.type_id
WHERE u.active=1 AND b.sched_entered=1
AND u.lastname LIKE CONCAT("%",'k', "%") OR b.comp_name LIKE CONCAT("%",'k', "%");
Second:
SELECT IF(u.lastname IS NULL,b.comp_name,CONCAT(u.name, " ", u.lastname)) AS name,u.user_ID,t.user_type,b.sched_entered
FROM users u
join business_users b on u.user_id=b.crid
join buz_usertype t on b.bus_user_type=t.type_id
WHERE u.lastname LIKE CONCAT("%",'k', "%") OR b.comp_name LIKE CONCAT("%",'k', "%") AND b.sched_entered=1 AND u.active=1;
Take a closer look towards the end and the where clause…in the first query it says
WHERE u.active=1 AND b.sched_entered=1
and in the second says
WHERE u.lastname LIKE CONCAT(“%”,‘k’, “%”) OR b.comp_name LIKE CONCAT(“%”,‘k’, “%”)
I just trying to use different syntax to accomplish the same thing.
And the question is if these two different syn-taxes accomplish the same thing.
Cause testing them I have a different result.
I thought they would bring the same result but they do not.
Can someone explain it to me?
It it reasonable to have different result?