Zobrazit data, jak navrhuje @Juan
select
row_number() over (
partition by modulecode order by modulecode
) as sessionid,
modulecode
from schedule
Když pak uživatel požádá o určité sessionid z určitého modulu, udělejte:
select *
from schedule
where sessionid = (
select sessionid
from (
select
sessionid,
row_number() over (order by sessionid) as module_sessionid
from schedule
where modulecode = 'B'
) s
where module_sessionid = 2
)