what syntax can I use for "cd.PlanID = (('0549'),('0545'))". I want this 2 plans data only.

sandy_xpac

New Member
Joined
Jul 13, 2016
Messages
33
from reports.dbo.Datamart_ClaimDetails cd LEFT OUTER JOIN
Reports.dbo.vwPlan as pd on cd.PlanID=pd.PlanID
where apptdate between '07/01/2016' and '4/30/2017'
and cd.PlanID = (('0549'),('0545'))


It gives me a syntax error at cd.planID= (('0549'),('0545'))
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Heaven knows I'm not a SQL guru, but wouldn't you want:

Code:
[COLOR=#333333]from reports.dbo.Datamart_ClaimDetails cd LEFT OUTER JOIN[/COLOR]
[COLOR=#333333]Reports.dbo.vwPlan as pd on cd.PlanID=pd.PlanID[/COLOR]
[COLOR=#333333]where apptdate between '07/01/2016' and '4/30/2017'[/COLOR]
[COLOR=#333333]and (cd.PlanID = '0549' or cd.PlanID = '0545')[/COLOR]

or

Code:
[COLOR=#333333]from reports.dbo.Datamart_ClaimDetails cd LEFT OUTER JOIN[/COLOR]
[COLOR=#333333]Reports.dbo.vwPlan as pd on cd.PlanID=pd.PlanID[/COLOR]
[COLOR=#333333]where apptdate between '07/01/2016' and '4/30/2017'[/COLOR]
[COLOR=#333333]and cd.PlanID IN ('0549','0545')[/COLOR]
 
Last edited:
Upvote 0
Heaven knows I'm not a SQL guru, but wouldn't you want:

Code:
[COLOR=#333333]from reports.dbo.Datamart_ClaimDetails cd LEFT OUTER JOIN[/COLOR]
[COLOR=#333333]Reports.dbo.vwPlan as pd on cd.PlanID=pd.PlanID[/COLOR]
[COLOR=#333333]where apptdate between '07/01/2016' and '4/30/2017'[/COLOR]
[COLOR=#333333]and (cd.PlanID = '0549' or cd.PlanID = '0545')[/COLOR]

or

Code:
[COLOR=#333333]from reports.dbo.Datamart_ClaimDetails cd LEFT OUTER JOIN[/COLOR]
[COLOR=#333333]Reports.dbo.vwPlan as pd on cd.PlanID=pd.PlanID[/COLOR]
[COLOR=#333333]where apptdate between '07/01/2016' and '4/30/2017'[/COLOR]
[COLOR=#333333]and cd.PlanID IN ('0549','0545')[/COLOR]


Hi Greg,

I tried the first code yesterday and it do not pull all the data BUT 2nd code works perfectly. Cheers mate :)

Thank you!
 
Upvote 0

Forum statistics

Threads
1,217,344
Messages
6,136,011
Members
449,977
Latest member
altizerc2196

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top