| Author |
Topic |
|
LOgle0917
Starting Member
9 Posts |
Posted - 2008-02-04 : 14:08:51
|
| I am pulling data that shows appt information on a patient:FName,LName, PhoneNumber, ApptDate, ApptTime, and Status that equals Active. I need to pull this info everyday. How can I set this up in a stored procedure to pull all this information automatically on a daily basis where it pulls by Appt Date that is 2 days greater than the current date?Thanks!Thanks!Lisa |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-02-04 : 14:14:29
|
| SELECT FName,Lname ,PhoneNumber, ApptDate, ApptTime FROM myTable WHERE Status= 'Active' and ApptDate > getDate() + 2Jack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-02-04 : 14:19:44
|
| SELECT FName,LName, PhoneNumber, ApptDate, ApptTime FROM yourTableWHERE DATEDIFF(day,current_timestamp,apptdate) = 2and Status = 'Active'JimP.S Now explain to you professor the difference between the two! |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-04 : 17:12:51
|
This is usually best to code these queries as a range, instead of running the table column through a function. If you use a function on a column, it will prevent use of an index on AppDateselect FName, Lname, PhoneNumber, ApptDate, ApptTimefrom myTable where Status= 'Active' and ApptDate >= dateadd(day,datediff(day,0,getDate())+2,0) and ApptDate < dateadd(day,datediff(day,0,getDate())+3,0) CODO ERGO SUM |
 |
|
|
LOgle0917
Starting Member
9 Posts |
Posted - 2008-02-05 : 09:24:12
|
| I have two tables that this information is pulling from. One is the Patient Table and one is the ApptHis Table. My fields in the ApptHis table are date and time when I try using these fields my fields turn blue, how can I correct this? Thanks!Thanks!Lisa |
 |
|
|
LOgle0917
Starting Member
9 Posts |
Posted - 2008-02-05 : 09:29:27
|
| Here is what I am trying to use it is an oracle database: SELECT Patient.PatientFirst, Patient.PatientLast, Patient.PatientHomeArea, Patient.PatientHomePhone, Patient.PatientStatus, ApptHis.AppHistDate, ApptHis.AppHistTimeFrom Patient, ApptHisWhere Status= 'Active' and ApptHis.ApptHisDate >= dateadd(day,datediff(day,0,getDate())+2,0) and ApptHis.ApptHisDate < dateadd(day,datediff(day,0,getDate())+3,0)Thanks!Lisa |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-05 : 09:45:02
|
quote: Originally posted by LOgle0917...it is an oracle database...
That changes things.CODO ERGO SUM |
 |
|
|
LOgle0917
Starting Member
9 Posts |
Posted - 2008-02-05 : 15:11:42
|
| I apologize as I guess I am asking my question in the wrong place. I am using Toad to pull the information and it is supposed to use SQL Scripting to pull the information. The client is an oracle client so I am confused on how to do this. I thought that SQL could be used but if the client is Oracle you have to use a little different programming. Sorry. I will look elsewhere for assistance.Thanks!Lisa |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-06 : 01:04:45
|
| Try at www.orafaq.com or www.dbforums.comMadhivananFailing to plan is Planning to fail |
 |
|
|
LOgle0917
Starting Member
9 Posts |
Posted - 2008-02-06 : 09:18:29
|
| Thank you!Thanks!Lisa |
 |
|
|
|