Hi, Please take a look and tweak accordingly
select Quotation.QNumber, DeliveryNote.DNumber
from
(
select 1 as id, 1 as qid, 1 as did
) as QuotationDN
full join
(
select 1 as id, (cast('2014-01-01' as DATE)) as QDate, 'q001/01/14' as QNumber
union all
select 2 as id, (cast('2014-01-25' as DATE)) as QDate, 'q002/01/14' as QNumber
) as Quotation
on QuotationDN.qid=Quotation.id
full join
(
select 1 as id, (cast('2014/01/02' as DATE)) as DDate, 'd001/01/14' as DNumber
union all
select 2 as id, (cast('2014/01/15' as DATE)) as DDate, 'd002/01/14' as DNumber
) as DeliveryNote
on QuotationDN.did=DeliveryNote.id
order by isnull(Quotation.QNumber,'z')
No comments:
Post a Comment