SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Another way
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jfxwave
Starting Member

USA
2 Posts

Posted - 12/13/2012 :  13:33:53  Show Profile  Reply with Quote
I'm working on this and i'm new to SQL and wanted to know if there was a shorter way to write this? Does "MonthReported" have to be written everytime or can i use a ", "?

quote:
SELECT DISTINCT
OperatorID,
RRCID,
LeaseName,
District,
FieldNumber,
YearReported,
MonthReported,
GasWellNumber,
GasProduction
INTO #Gasleases
FROM GasProductionCopy(NOLOCK)
WHERE (YearReported = 2010) AND ( MonthReported = 9 OR MonthReported = 10 OR MonthReported = 11 OR MonthReported = 12)

sodeep
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 12/13/2012 :  13:36:53  Show Profile  Reply with Quote
SELECT DISTINCT
OperatorID,
RRCID,
LeaseName,
District,
FieldNumber,
YearReported,
MonthReported,
GasWellNumber,
GasProduction
INTO #Gasleases
FROM GasProductionCopy(NOLOCK)
WHERE (YearReported = 2010) AND MonthReported in (9,10,11,12)
Go to Top of Page

jfxwave
Starting Member

USA
2 Posts

Posted - 12/13/2012 :  13:49:56  Show Profile  Reply with Quote
Thanks for the fast reply!
I knew it was easy but thats going to save me some time.

Thanks again
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000