?
Solved

Select Date

Posted on 2008-10-20
7
Medium Priority
?
193 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:Seven price
[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:Seven price
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
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

 
LVL 9

Author Comment

by:Seven price
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 2000 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:Seven price
ID: 31507892
Thanks
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 22760760
glad I could help
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 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