Hey all I want to write a join condition which depends on the DATA in the joining table, I'll explain: Let's sat my first table is the users table which holds "UserId" (unique) and other details. My second table holds users permissions, there may be a row for each user from the first table, IF NOT then i need to get the row with UserId=0 (general permission). I'm trying to join these two tables with a condition that gets the permission for each user, and if not exists a row with the UserId I should join to UserId=0. Anyone got an idea how to make this conditional join within one query. (MSSQL 2K SP4) Thanks.