i need a smart query

i have a 3 tables stores, cats and relcats

in stores, i keep all stores info
in cats, i keep all cats info
in relcats, i choose related categories for each stores.

with these tables, i show related categories for each store.

now i want to show related stores for each store using relcats table.

ex:for Dell, i choose related categories as PCs, Notebooks.
and we know: HP, sony are related stores for it ( i.e. i choose PCs, notebooks as related categories for both HP and Sony)

so now when i access Dell page,
i want to show HP, Sony under related stores.

please help me with this

thanks a bunch in advance.