>>>According to the VFP Help HAVING without group by has the same effect as WHERE. Therefore, for me the latter of your suggestions is better. Or dealing with the query cursor in VFP after it is selected in a separate SQL Select.
>>
>>Yes it has the same effect but it executes later and can see field aliases.
>
>You are correct. I knew there was no use reading VFP help <g>. Thank you.
It doesn't work this way in SQL Server.
I just tried
select ID, Searched as Search from TestTable having Search like 'Daughter%'
and it produced an error.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'Search'.
This didn't work either
select max(ID) as MaxID, Searched as Search from TestTable group by Searched having Search like 'Daughter%'
Only using the original field name like
select max(ID) as MaxID, Searched as Search from TestTable group by Searched having Searched like 'Daughter%'
worked.
If it's not broken, fix it until it is.
My Blog