select .dbo.ve_getshortpath(itemid), text from transitions tt join contents cc on cc.contentid = tt.fromid join items ii on cc.contentid = ii.contentid where trantype = 1 --where toid <> rangeid and trantype = 2 --not in (2,0) --select distinct trantype from transitions --select * from contents where contentid = 778