Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have two table currentmember[record of current existing users] and memberhistory
[ex-users]
they both maintain seprate records
Both tables have same structure and
mem_id uniqueidetifier,
membername varchar(200),
DOB DATETIME,
Address varchar(500)

Please Note:
memberhistory table content records when user leave the orgaization it moved to memberhistory table
and deleted from currentmember table


NOW i want to fetch records from both table irrespective of current and history table
with single query according DOB DESC
PLEASE HELP
Many thanks..
Posted
Updated 7-Jan-12 19:28pm
v2

1 solution

You can use a UNION operator, like :
SQL
select * from (
select * from [ex-users]
union 
select * from [memberhistory]
) as t order by DOB_DATETIME 
 
Share this answer
 
v2
Comments
Rakesh S S 8-Jan-12 3:22am    
Without Union is it possible?
Mehdi Gholam 8-Jan-12 3:33am    
Try and see!
Amir Mahfoozi 8-Jan-12 4:40am    
+5 Also he can use a field named Active and set it to 0 when someone leaves his organization.
Mehdi Gholam 8-Jan-12 5:02am    
Thanks
Rakesh S S 8-Jan-12 8:25am    
It is possible to have a mode active and inactive but

@ same time same table was used in many other modules

n i dont want to disturb current flow

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