|
-
Jan 20th, 2010, 11:49 PM
#1
Thread Starter
Member
Find Minimum and Maximum
Dear Experts
SqlServer Table1 has data as follows
Sno-------date
1------01/01/2010
8------01/01/2010
1------02/01/2010
5------02/01/2010
2------18/01/2010
9------18/01/2010
3------18/01/2010
1------03/01/2010
6------03/01/2010
My questions are:
1) I want to display the SMALLEST Date into textbox1 which is 01/01/2010
2) I want to display the BIGGEST Date into textbox2 which is 18/01/2010
3) I want to display the BIGGEST SNO against date 18/01/2010 into textbox3 which is 9
4) I want to display total records against date 18/01/2010 into textbox4 which is 3
Please help
-
Jan 21st, 2010, 12:21 AM
#2
Re: Find Minimum and Maximum
If you want to do this using SQL code, so you only retrieve those specific values from the database, then use something like:
SQL Code:
SELECT MIN([Date]) FROM Table1
There are other native functions too, like MAX and COUNT, that will be useful to you. If you want to get the min or max for a subset then you simply add a WHERE clause, e.g.If you already have a populated DataTable then you can use its Compute method to do similar things.
For future reference, if you're specifically asking for information on SQL code then that would belong in the Database Development forum.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|