Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select specify date in btwn two columns......

Author  Topic 

rvan
Starting Member

28 Posts

Posted - 2007-01-26 : 16:19:28
First of all I wants to "Thank You" all of you has been trying to helps me solve some of the problems.

Now, I come across trying to get data records from 3 columns but two columns "SeasonalStartsuppressiondate" & "SeasonalEndSuppressionDate" both contain no year last four digits. How would I select a query have some records that customer is not fall in between vacation time given a particular months Mar/02/ and Nov/04/? I only want record with “Y” fields not in those months. Notice don't have "YEAR" at the end and so, I can't determine it year of 2005 or 2006.

Here's my table and query statement:

Table - Column fields
SeasonalFlag, SeasonalStartSuppDate, SeasonalEndSuppDate
Y , 04/02 , 11/04
N , .... , ....

Query Statement
SELECT SeasonalFlag, SeasonalStartSuppDate, SeasonalEndSuppDate

FROM
advodb ----<<<<my sample query>>>>>-----
WHERE (seasonalflag='y'
AND
convert(datetime,seasonalstartsuppdate + '/2007')< getdate()
AND
convert(datetime,seasonalendsuppdate + '/2007') > getdate())


thank you



RV

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-26 : 17:09:22
select * from table1 where col1 not like '[0-9][0-9]/[0-9][0-9]/[0-9][0-9]'

???


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -