SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 When No Row Exists Return Value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

8 Posts

Posted - 02/15/2013 :  09:13:09  Show Profile  Reply with Quote
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

Flowing Fount of Yak Knowledge

2241 Posts

Posted - 02/15/2013 :  09:16:03  Show Profile  Reply with Quote
Try this......

FROM tblLånere
RIGHT JOIN eaAllotments

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000