Microsoft
Software
Hardware
Network
Question : how to match corresponding records from two tables
I have INTAKE table with following data.
IntakeID Dateintake AnimalID
1 2009-02-05 001
2 2009-06-19 002
3 2009-07-06 003
4 2009-07-12 004
5 2009-07-15 005
6 2009-08-04 003
7 2009-08-04 004
8 2009-08-14 003
9 2009-12-12 004
I have LICENSE table which will show the license dates purched for the corresponding AnimalID
LicenseID AnimalID DatePurchased
2009-01 004 2009-08-09
2009-02 003 2009-08-12
2009-03 004 2009-12-16
I need to show the results as follows:
AnimalID LicenseID DatePurchesed
001 - -
002 - -
003 2009-02 2009-08-12
004 2009-01 2009-08-09
004 2009-03 2009-12-16
Can some body please help me how to write T-sql script for the above structure.
Thanks
Answer : how to match corresponding records from two tables
SELECT A.AnimalID , LicenseID ,DatePurchesed
FROM (SELECT DISTINCT AnimalID FROM INTAKE ) a
LEFT JOIN LICENSE l
on l.animalId = a.animalid
Random Solutions
explorer view ie8 on windows 7 and wss 3.0
Nvidia Geforce 8400M GS in a Sony Vaio SZ650N/C WINDOWS 7 INCOMPATIBLE?
Is there an Access function equivalent to the Quartile function in Excel?
what is the difference between utf-8 or utf-7 both are unicode
WinMgmt errors in event log, started after applying latest updates
Building VPN with DI524 dlink router
Access Web front-End
Converting txt files into Access or Excel format
SQL insert question
EM_FORMATRANGE gives insufficient memory when printing with PCL 6