Advertisement

05.19.2008 at 08:48AM PDT, ID: 23414102
[x]
Attachment Details

sql syntax to query to see if prior visits

Asked by running32 in SQL Query Syntax, Databases Miscellaneous, MS SQL Server

I need to add a flag to my select statement to indicate if they have been seen in prior year.  How can I add a flag to my select statement of say if they where seen in any year prior to 2008 flag as yes.  thanksStart Free Trial
1:
2:
3:
4:
5:
SELECT DISTINCT  dtmIntake AS 'dtmcontact', 'Connections' AS 'Program', strfname, strlname ,dtmdob, strdata                     
                        FROM      tblMHCIntake as m inner join tblPatient as p on m.lngPatientid = p.lngPatientid left join tblLuMHCData as l on m.lngcontacttype = l.lngDataid   where strdata <> 'Phone'    and dtmIntake between '01/01/2008' and '12/31/2008'            
                                         
                
                        order by dtmContact desc
[+][-]05.19.2008 at 08:55AM PDT, ID: 21598875

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, Databases Miscellaneous, MS SQL Server
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.19.2008 at 08:57AM PDT, ID: 21598900

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 09:03AM PDT, ID: 21598951

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 10:21AM PDT, ID: 21599707

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906