Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @themaid int = 1 ; -- themeID
- declare @trefwoord nvarchar(max) = '' ; -- search query
- select p.*
- from tblProjecten p left join tblProjectenThema pt on p.projectId = pt.projectId
- where pt.themaId = coalesce(@themaid, pt.themaId) and
- p.naam like '%' + @trefwoord + '%' ;
- declare @themaid int = 1 ;
- declare @studiegebiedid int = null ;
- declare @opleidingdtypeid int = null ;
- declare @doelgroepid int = null ;
- declare @organisatorid int = null ;
- declare @regioid int = null ;
- declare @trefwoord nvarchar(max) = '' ;
- select p.*
- from tblProjecten p left join tblProjectenThema pt on p.projectId = pt.projectId
- left join tblProjectenStudiegebieden ps on p.projectId = ps.projectid
- left join tblProjectenOpleidingsType pot on p.projectId = pot.projectID
- left join tblProjectendoelgroep pd on p.projectId = pd.projectId
- left join tblProjectenOrganisator po on p.projectId = po.projectId
- left join tblProjectenRegio pr on p.projectId = pr.projectId
- where pt.themaId = coalesce(@themaid, pt.themaId) and
- ps.studiegebiedid = coalesce(@studiegebiedid, ps.studiegebiedid) and
- pot.opleidingsID = coalesce(@opleidingdtypeid, pot.opleidingsID) and
- pd.doelgroepId = coalesce(@doelgroepid, pd.doelgroepid) and
- po.organisatorId = coalesce(@organisatorid, po.organisatorId) and
- pr.regioId = coalesce(@regioid, pr.regioId) and
- p.naam like '%' + @trefwoord + '%' ;
Add Comment
Please, Sign In to add comment