Advertisement

06.23.2008 at 01:59PM PDT, ID: 23509121
[x]
Attachment Details

Using 'and and 'or' in where statment

Asked by bwanagat in SQL Query Syntax, MySQL, SQL Server 2005

Tags: SQL, Sequel, 2007

Below is a where statment that I am trying to get working.
the date range is the main driver. and then the subsequent fields are what gets the detail record I need.
Where (pat.chg_date >= '06/20/2007' and pat.chg_date <= '06/22/2008'
and pat.pat_status_cn = '2'
and rx.ndc in ('00088115330', '00088115003', '68546031730')
and pat.chart_id is not NULL)
or (disp.dispense_date >= '06/20/2007' and disp.dispense_date <= '06/22/2007'
and pat.pat_status_cn = '1'
and rx.last_disp_prod like 'cop%'
and pat.chart_id is not NULL
and disp.fill_no = 1)Start Free Trial
 
 
[+][-]06.23.2008 at 02:10PM PDT, ID: 21850380

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.

 
[+][-]06.23.2008 at 02:16PM PDT, ID: 21850421

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.

 
[+][-]06.23.2008 at 02:19PM PDT, ID: 21850454

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, MySQL, SQL Server 2005
Tags: SQL, Sequel, 2007
Sign Up Now!
Solution Provided By: Chumad
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628