I have to do a group by firstname
and address
on this sort of data
| firstname | address
+-----------+----------
| alex | 338 s. michigan
| mark | finger
| alex | 338 south michigan
| ted | port
But the group by will not return similar values of the address
field.
Is there a pattern I can apply to the group by? I want to use the LIKE pattern system so I can do for example
select firstname, address from t group by firstname, '%'+SUBSTRING(address,0,5)+'%'
but that syntax doesn't seem to work.
Any ideas? Thanks!