Try this Royal:
select m.citystate_nm, x.citystate_nm
from dbo.tb_citystate_master m
inner join
(
select statelink_cd, citystate_nm
from dbo.tb_citystate_master
)
x on (m.citystate_cd = x.statelink_cd)
where (m.statelink_cd = 0)
order by m.citystate_nm, x.citystate_nm
that should give you states with cities
If you then add a conditioning statement to the rowbound event that says something like:
if rowcount > 1 then ..
if previous row cell "state name" = current row cell "state name" then ...
set current row cell "state name" = "".
you should end up with a grid that has states and cities - but with only the first state listed.
Joe
Enter your message below
Sign in or Join us (it's free).