SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
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  

Anouar
Starting Member

Denmark
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
Anouar

bandi
Flowing Fount of Yak Knowledge

India
2202 Posts

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

FROM tblLånere
RIGHT JOIN eaAllotments

--
Chandu
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.03 seconds. Powered By: Snitz Forums 2000