Solved

Select Date

Posted on 2008-10-20
7
179 Views
Last Modified: 2012-05-05

Is there a way to have a select statement that shows a description by date.
If the date is today date or pass date description will show up if the date is a future date then the description
does not show up until the present date.
0
Comment
Question by:sevensnake77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 22759778
select your_date, your_description from your_table
where your_date <= sysdate;
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 22759787
the above would be for oracle.

if you're using sql server instead of Oracle put GETDATE() in where there is SYSDATE
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 22760428
Somthing like this

SELECT Id, StartDate, summary Category FROM [News] A
Join Category B	on B.PKCategoryId  = A.Category
where GetDate() = StartDate

Open in new window

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 9

Author Comment

by:sevensnake77
ID: 22760507
I tried somethinglike this
WHERE (StartDate >= (2009-09-29) )
But did not seem to work the way I want
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 22760614
GetDate() will give you a date and time so unless StartDate exactly matches the current time down to the second your equality won't work...

but this should...

SELECT Id, StartDate, summary Category FROM [News] A
Join Category B      on B.PKCategoryId  = A.Category
where GetDate() >= StartDate
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 31507892
Thanks
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 22760760
glad I could help
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question