473,586 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying date through sql query?

hi friends,
can we display last ten dates from current system date using sql
query.
example todays date
19/4/2008 from this last 10 days
18/4/2008
17/4/2008
16/4/2008
'
'
'
9/4/2008
is this possible.
i dont have any table that give me dates.
i am working on SQl server.
Jun 27 '08 #1
2 1024
Not sure what you want to do

if you have these dates in a table then its

SELECT TOP 10 mydatefield FROM mytable

if you dont then

Dim dateArr(9)
For i = 0 To -9 Step -1
dateArr(Math.Ab s(i)) = DateAdd(DateInt erval.Day, i,
DateAndTime.Now )
Response.Write( DateAdd(DateInt erval.Day, i, DateAndTime.Now ))
Response.Write( "<br>")
Next

"ravi" <sa*********@gm ail.comwrote in message
news:b4******** *************** ***********@w8g 2000prd.googleg roups.com...
hi friends,
can we display last ten dates from current system date using sql
query.
example todays date
19/4/2008 from this last 10 days
18/4/2008
17/4/2008
16/4/2008
'
'
'
9/4/2008
is this possible.
i dont have any table that give me dates.
i am working on SQl server.
Jun 27 '08 #2
simple query:

with foo (d , level)
as
(
select getdate(),1
union all
select dateadd(day,-level,d), level + 1
from foo
where level < 10
)
select d
from foo
-- bruce (sqlwork.com)

ravi wrote:
hi friends,
can we display last ten dates from current system date using sql
query.
example todays date
19/4/2008 from this last 10 days
18/4/2008
17/4/2008
16/4/2008
'
'
'
9/4/2008
is this possible.
i dont have any table that give me dates.
i am working on SQl server.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1952
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for the first page): display the section name, the current file and a few archive files. If there is more than a page full (for each additional page):...
2
2351
by: Russ | last post by:
I've got a report that puts dates at the top of columns and the user is prompted to enter a beginning date when the report is opened. That date is put in a textbox in the first column like this: =DateValue() Then the next columns are textboxes that add 7 to the previous column for the date display of the next week like this: =+7
6
4069
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form the user can change the date, which will force a requery in the subform to bring up records from the date selected. My question is this... The...
7
11822
by: Joe | last post by:
I am using Access 2003 and are linking to an Oracle 9i ODBC datasource (using Oracle ODBC drivers). After linking the tables in Access, I inspect the data contained in the linked tables. For tables that involve a number field as the primary key, the data is returned successfully. For tables that involve a character field (e.g. CHAR(3) or...
12
4698
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that variable in the url. I would like that variable to trigger a stored and
2
1570
by: nsymiakakis | last post by:
Hello Everyone, I am almost completed with this database, the only thing left is to graph the results of a query. I built a parameter query that gives me totals for a date range that I enter. This works great. I created a column called "Month", and I am entering the month and year corresponding to the "Date" field. ie. (03/15/06 for the date)...
4
3423
by: Panna | last post by:
Hey there I am using phpMyAdmin and MySQL to develop a dbase application. I have a dropdown menu on one of the pages which gets populated automatically with data from a table in the database. The code for this is as follows: $sql3="SELECT ID, UploadDate FROM Telkom"; $result2=mysql_query($sql3); $options="";
2
1237
by: trysenthil | last post by:
hi all., i want a query from u.,which must display me like this., is displaying me., 07-september-2007
5
1942
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date : combobox of month(emonth) & combobox of year(eyear) I want the records between this month and year.i have written the below query for that: suppose,...
482
27506
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.