Click here to Skip to main content
15,891,431 members
Home / Discussions / Database
   

Database

 
AnswerRe: Redundant Data? Pin
jesus.online15-Oct-08 5:45
jesus.online15-Oct-08 5:45 
QuestionHow to Drop a Table with Dependencies Pin
Vimalsoft(Pty) Ltd15-Oct-08 1:39
professionalVimalsoft(Pty) Ltd15-Oct-08 1:39 
AnswerRe: How to Drop a Table with Dependencies Pin
Paddy Boyd15-Oct-08 1:56
Paddy Boyd15-Oct-08 1:56 
GeneralRe: How to Drop a Table with Dependencies Pin
Vimalsoft(Pty) Ltd15-Oct-08 20:12
professionalVimalsoft(Pty) Ltd15-Oct-08 20:12 
AnswerRe: How to Drop a Table with Dependencies Pin
Mycroft Holmes15-Oct-08 16:44
professionalMycroft Holmes15-Oct-08 16:44 
GeneralRe: How to Drop a Table with Dependencies Pin
Vimalsoft(Pty) Ltd15-Oct-08 20:13
professionalVimalsoft(Pty) Ltd15-Oct-08 20:13 
QuestionProblem with FULL OUTER JOIN Pin
dlarkin7715-Oct-08 0:42
dlarkin7715-Oct-08 0:42 
AnswerRe: Problem with FULL OUTER JOIN Pin
Syed Mehroz Alam15-Oct-08 1:43
Syed Mehroz Alam15-Oct-08 1:43 
Looking at the output you want, I dont think you need a "full" outer join since you always want to match UserID and SyncTableName. Here's a solution.

I will use a two-step procedure to solve this:
1. Get unique UserID and SyncTableNames (Creating a CTE will be best here)
2. Have a left outer join with the two tables

--create a CTE
With UserTableMods( [UserID], [SyncTableName])
As 
(
	Select distinct [UserID], [SyncTableName] from [WebSyncTimesMS] 
	union
	Select distinct [UserID], [SyncTableName] from [WebSyncHistory]
)

--Get result
Select UTM.[UserID], UTM.[SyncTableName], H.[SyncTime], M.[LastActionTime] 
From UserTableMods UTM
LEFT OUTER JOIN [WebSyncHistory] H ON UTM.USERID=H.USERID and UTM.[SyncTableName]=H.[SyncTableName]
LEFT OUTER JOIN [WebSyncTimesMS] M ON UTM.USERID=M.USERID and UTM.[SyncTableName]=M.[SyncTableName]


And here's the result:

1	Categories	2008-01-01 	NULL
1	DeviceSettings	NULL	   	2008-01-01 
1	Products	2008-01-01 	2008-08-31 
2	Categories	NULL	   	2008-01-01 
2	DeviceSettings	2008-01-01 	2008-08-31 


You can use the Grouping and Max functions as per your requirement. Hope that helps.

Regards,
Syed Mehroz Alam


GeneralRe: Problem with FULL OUTER JOIN Pin
dlarkin7715-Oct-08 1:51
dlarkin7715-Oct-08 1:51 
GeneralRe: Problem with FULL OUTER JOIN Pin
Syed Mehroz Alam15-Oct-08 2:07
Syed Mehroz Alam15-Oct-08 2:07 
QuestionProblem with group column Pin
eyeseetee15-Oct-08 0:01
eyeseetee15-Oct-08 0:01 
AnswerRe: Problem with group column Pin
Giorgi Dalakishvili15-Oct-08 0:10
mentorGiorgi Dalakishvili15-Oct-08 0:10 
GeneralRe: Problem with group column Pin
eyeseetee15-Oct-08 0:19
eyeseetee15-Oct-08 0:19 
GeneralRe: Problem with group column Pin
Giorgi Dalakishvili15-Oct-08 0:37
mentorGiorgi Dalakishvili15-Oct-08 0:37 
QuestionHow to change the returned data in SQL? Pin
obarahmeh14-Oct-08 23:16
obarahmeh14-Oct-08 23:16 
AnswerRe: How to change the returned data in SQL? Pin
HemJoshi14-Oct-08 23:56
HemJoshi14-Oct-08 23:56 
GeneralRe: How to change the returned data in SQL? Pin
obarahmeh15-Oct-08 2:11
obarahmeh15-Oct-08 2:11 
AnswerRe: How to change the returned data in SQL? Pin
Paddy Boyd15-Oct-08 1:57
Paddy Boyd15-Oct-08 1:57 
Questionretrieving file using SQL Query Pin
r aa j14-Oct-08 21:07
r aa j14-Oct-08 21:07 
AnswerRe: retrieving file using SQL Query Pin
Mycroft Holmes14-Oct-08 22:03
professionalMycroft Holmes14-Oct-08 22:03 
GeneralRe: retrieving file using SQL Query Pin
r aa j15-Oct-08 3:08
r aa j15-Oct-08 3:08 
Questionvisual studio 2005,SQL Data source problem Pin
amit201114-Oct-08 6:49
amit201114-Oct-08 6:49 
AnswerRe: visual studio 2005,SQL Data source problem Pin
Wendelius14-Oct-08 7:40
mentorWendelius14-Oct-08 7:40 
AnswerRe: visual studio 2005,SQL Data source problem Pin
Jerry Hammond14-Oct-08 7:48
Jerry Hammond14-Oct-08 7:48 
QuestionDatabase Subjects Pin
Jim Warburton14-Oct-08 5:02
Jim Warburton14-Oct-08 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.