Click here to Skip to main content
16,013,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am Joing Two table data below query

SQL
SELECT ALD.LateMintsDate,ALD.LateMints,ALD.DeductMints,AED.EarlyOutDate,AED.EarlyOut,AED.DeductMints
FROM Accounts_LateMints_Details ALD FULL OUTER JOIN Accounts_EarlyOut_Details AED
ON ALD.LateMintsDate=AED.EarlyOutDate AND ALD.UserID=1001 and ALD.Months='December' and ALD.Years=2014


This above Query wise came Result I don't want in below data.
EmpID LateDate EarlyOutDate
1001 2-Dec-14 NULL
1001 10-Dec-14 NULL
1001 29-Dec-14 NULL
1001 NULL 18-Dec-14
1001 NULL 26-Dec-14


But I want joining Two Table result is Below Data

EmpID LateDate EarlyOutDate
1001 2-Dec-14 NULL
1001 10-Dec-14 NULL
1001 NULL 18-Dec-14
1001 NULL 26-Dec-14
1001 29-Dec-14 NULL



Thank You
Posted
Comments
_Asif_ 4-Feb-15 6:37am    
Seems like you have some sorting problem? I mean you want to sort the data in defined order?
Frankie-C 4-Feb-15 6:40am    
What exactly you want?
If the ordering is the problem use order by.
Nirmal Chandru 4-Feb-15 6:58am    
I want above me joined two table But Latetedate with earlyoutdate at the
the same time order the below result wise want.
EmpID LateDate EarlyOutDate
1001 2-Dec-14 NULL
1001 10-Dec-14 NULL
1001 NULL 18-Dec-14
1001 NULL 26-Dec-14
1001 29-Dec-14 NULL

1 solution

The data is the same: it's just the order that is different.
So if you want to specify the order in which SQL returns rows, you have to add an ORDER BY clause - or SQL is at liberty to return rows in any order convenient to it. That order may not be the same the next time you run the same query unless ORDER BY is included.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900