Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 When No Row Exists Return Value

Author  Topic 

Anouar
Starting Member

8 Posts

Posted - 2013-02-15 : 09:13:09
Im using 2 tables, with the following query:

SELECT Lånernr, Lånernavn, SUBSTRING(CPRNummer, 0, 7) AS Fødselsdag, Allotment
FROM tblLånere
INNER JOIN eaAllotments ON eaAllotments.Lånernummer = tblLånere.LånerNr
WHERE EksamensAnsvarlig = 1 AND Period_id = 17

The issue is that the table allotments not always have a record for a user (låner). I would like to have a null value or something.

Best Regards
Anouar

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-02-15 : 09:16:03
Try this......

FROM tblLånere
RIGHT JOIN eaAllotments

--
Chandu
Go to Top of Page
   

- Advertisement -