• 0

Help with MSSQL Server 2000


Question

Hi there,

I started programming queries with MSSQL Server 2000, and I have a question for you guys.

I need a query that returns the next activity (in date from now) from a list of activities in a SQL database.

******************

Example :

SELECT TOP 1 Date, Activity

FROM dbo.Activities

WHERE ???????

ORDER BY Date

******************

How the hell am I supposed to write it ? I would really appreciate if you guys could send me the correct syntax.

THANKS A LOT !

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

where date>todays_date

if you know what i mean..

you want only one selection from db where date is greater than today's date?

if so,...

where date>todays_date limit 0,1

Link to comment
Share on other sites

  • 0

I tried what you said, but it doesn't seem to work... am I missing something here ?

The only thing I need in fact is a way to return today's date : I tried the "Today ()" or "GetDate ()" variables, but my system refuses to valid my syntax. After that, I tried this :

SELECT TOP 1 Date, Titre

FROM dbo.Activit?s

WHERE dateDiff("dd",Date,getdate())<=0

The syntax is OK, but when I try to save the query I get an ADO error for misusing the GetDate() function ???

I'M STUCK. Could someone help me ?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.