Solved

Select Date

Posted on 2008-10-20
7
175 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

829 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