Hi, bbychkov
Thanks your response and your query did works. But since this is a ad-hoc query, In advance I did not know th possible value
for caption column. Hopfully there is a solution which did not use 'lname' and 'charge' inside the query. I mean if I put this query inside a procedures, it should work against any data in test table
on different environment.
This must be a big challenge!