Click here to Skip to main content
15,912,400 members
Home / Discussions / Database
   

Database

 
GeneralRe: Multi table queries Pin
myNameIsRon3-Feb-06 5:15
myNameIsRon3-Feb-06 5:15 
AnswerRe: Multi table queries Pin
Colin Angus Mackay2-Feb-06 22:48
Colin Angus Mackay2-Feb-06 22:48 
GeneralRe: Multi table queries Pin
myNameIsRon3-Feb-06 5:16
myNameIsRon3-Feb-06 5:16 
AnswerRe: Multi table queries Pin
Sri Vidhya3-Feb-06 21:58
Sri Vidhya3-Feb-06 21:58 
GeneralRe: Multi table queries Pin
myNameIsRon4-Feb-06 5:20
myNameIsRon4-Feb-06 5:20 
QuestionThis beginner needs some HELP with SQL Registration Pin
alexvw2-Feb-06 12:25
alexvw2-Feb-06 12:25 
AnswerRe: This beginner needs some HELP with SQL Registration Pin
Mike Dimmick4-Feb-06 4:57
Mike Dimmick4-Feb-06 4:57 
QuestionNeed help for sql ASAP Phuleez Pin
Minoo S2-Feb-06 10:29
Minoo S2-Feb-06 10:29 
I need to match entries of two tables Survey and Phones . Donno what am I missing on

Tables and example :
Phones
[CaseID], [SurveyID],[DateTime], [TelephoneNumber]
90 13875 2006-01-05 10:31:00.000 2814211345 NULL
90 13875 2006-01-05 10:33:00.000 2814211345 NULL

Survey has following columns
[CaseID], [SurveyID], [CaseStartTime],[Phone]
90 13875 2006-01-05 10:31:00.000 2814211345 NULL
90 13875 2006-01-05 10:33:00.000 2814211345 NULL


There are multiple entries of CaseID in both the tables. When a call is made, there is an entry in Phones table and after that an entry is made in Survey table. Timelag could vary from millisec to 2 or 3 mins.So the way to identify is through timestamp, factoring in mins difference.

I am using this query - does not match correctly though

SELECT t1.CaseID, t1.CaseStartTime,t1.ITS, t2.CaseID,t2.DateTime,
DateDiff("n", t2.DateTime,t1.CaseStartTime)as "Min_Diff"
FROM Survey AS t1,Phones AS t2
WHERE t1.CaseID = t2.CaseID and t1.CaseID=90
and DateDiff("n", t2.DateTime,t1.CaseStartTime) <= 2 and DateDiff("n", t2.DateTime,t1.CaseStartTime) >0
Order by t1.CaseID;

Result
90 2006-01-05 10:33:00.000 47 90 2006-01-05 10:31:00.000 2



Minoo S
AnswerRe: Need help for sql ASAP Phuleez Pin
Colin Angus Mackay2-Feb-06 10:59
Colin Angus Mackay2-Feb-06 10:59 
AnswerRe: Need help for sql ASAP Phuleez Pin
Minoo S2-Feb-06 17:31
Minoo S2-Feb-06 17:31 
GeneralRe: Need help for sql ASAP Phuleez Pin
Colin Angus Mackay2-Feb-06 20:58
Colin Angus Mackay2-Feb-06 20:58 
GeneralRe: Need help for sql ASAP Phuleez Pin
Minoo S3-Feb-06 7:16
Minoo S3-Feb-06 7:16 
GeneralRe: Need help for sql ASAP Phuleez Pin
Minoo S5-Feb-06 8:43
Minoo S5-Feb-06 8:43 
GeneralRe: Need help for sql ASAP Phuleez Pin
Colin Angus Mackay5-Feb-06 8:47
Colin Angus Mackay5-Feb-06 8:47 
GeneralRe: Need help for sql ASAP Phuleez Pin
Minoo S19-Apr-06 6:14
Minoo S19-Apr-06 6:14 
QuestionCreating SQL Blocks? Pin
Justin Cooke2-Feb-06 4:36
Justin Cooke2-Feb-06 4:36 
Questionmerging two tables or two datasets Pin
dansoft2-Feb-06 4:23
dansoft2-Feb-06 4:23 
AnswerRe: merging two tables or two datasets Pin
Chris Meech2-Feb-06 7:54
Chris Meech2-Feb-06 7:54 
GeneralRe: merging two tables or two datasets Pin
dansoft2-Feb-06 15:49
dansoft2-Feb-06 15:49 
QuestionConnection Pooling ADo.Net Pin
faviochilo2-Feb-06 3:21
faviochilo2-Feb-06 3:21 
AnswerRe: Connection Pooling ADo.Net Pin
Le centriste2-Feb-06 6:52
Le centriste2-Feb-06 6:52 
QuestionAdd JPEG In MySQL5.0 Table via VB6.0 Pin
jobje2-Feb-06 1:56
jobje2-Feb-06 1:56 
QuestionIs SELECT INTO optimal to copy data? Pin
Salil Khedkar2-Feb-06 1:54
Salil Khedkar2-Feb-06 1:54 
AnswerRe: Is SELECT INTO optimal to copy data? Pin
Mike Dimmick2-Feb-06 2:32
Mike Dimmick2-Feb-06 2:32 
QuestionHelp!!Compacting Database MSDE/SQL Pin
jfk_lili1-Feb-06 22:35
jfk_lili1-Feb-06 22:35 

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.