Home All Groups Group Topic Archive Search About
Author
22 Jun 2005 3:06 AM
AAA
what is the mininum and maximum value in SQL statement

select * from table1 where field1 between "minumum" and "maximum"

then it will show up all the value in table1

thank

regards
Author
22 Jun 2005 8:47 AM
Shai Goldberg
To show up all the values in the table you don't need to use the Where clause.

In order for your SQL Statement to work as you wish you should put the
min/max aggregate function inside a subquery, therefor you SQL Statement
should look like this:

select * from table1 where field1 between
    (Select Min(feild1) From table1) And
    (Select Max(feild1) From table1)

but again, I must say that it will be better to remove the where clause to
see all the records in the table.

--
Shai

Show quoteHide quote
"AAA" wrote:

> what is the mininum and maximum value in SQL statement
>
> select * from table1 where field1 between "minumum" and "maximum"
>
> then it will show up all the value in table1
>
> thank
>
> regards
>
>
>
Are all your drivers up to date? click for free checkup

Author
22 Jun 2005 12:12 PM
Patrice
I'm not sure what you want :

1) To show all : SELECT * FROM Table1

2) To find out min, max values : SELECT MIN(Field) AS MinField,MAX(Field) AS
MaxField FROM Table1

Patrice

--

Show quoteHide quote
" AAA" <pk***@hotmail.com> a écrit dans le message de
news:elFyudtdFHA.412@tk2msftngp13.phx.gbl...
> what is the mininum and maximum value in SQL statement
>
> select * from table1 where field1 between "minumum" and "maximum"
>
> then it will show up all the value in table1
>
> thank
>
> regards
>
>
Author
22 Jun 2005 1:08 PM
Thor Kornbrek
select * from table1 where field1 >= 5 and field1 <= 11

I think this is what you are looking for.
--
Thor Kornbrek
..Net Developer
http://www.geekguild.net


Show quoteHide quote
"AAA" wrote:

> what is the mininum and maximum value in SQL statement
>
> select * from table1 where field1 between "minumum" and "maximum"
>
> then it will show up all the value in table1
>
> thank
>
> regards
>
>
>
Author
23 Jun 2005 10:08 PM
Mythran
" AAA" <pk***@hotmail.com> wrote in message
news:elFyudtdFHA.412@tk2msftngp13.phx.gbl...
> what is the mininum and maximum value in SQL statement
>
> select * from table1 where field1 between "minumum" and "maximum"
>
> then it will show up all the value in table1
>
> thank
>
> regards
>
>

select * from table1 where field1 between 1 and 10.

Minimum is the lowest point of the range to find.
Maximim is the highest point of the range to find.

So, only those rows where field1 is greater than or equal to 1 and less than
or equal to 10 will be returned.

Mythran
Author
24 Jun 2005 1:05 AM
AAA
Actually, I create a few textboxs for user to enter criteria for them to
search the data under vb.net application.

when user leave the texbox(criteria) is blank, it will show up all the data.

my SQL statement would be like

select * from table1 where field1 between textbox1.text and textbox2.text
AND field2 between textbox3.text and textbox4.text........until field 5.

When user key in something in the textbox, then I just simply use the
textbox value. then no problem for my sql statment.

but when user leave all textbox(criteria) blank, meaning that the user want
to see all information, then I can not bring the textbox blank value in the
sql statement, because there is no such function like "select * from table1
where field between and "......because my textbox are blank value.....

so I am thinking to find out the min value of ascii code and max value of
ascii, so when it detect my textbox1.text is blank, then it will not be
shown blank, but instead of the mininum value of ascii code.

"select * from table1 where field between (min value ascii) and (max value
of ascii)"

Show quoteHide quote
" AAA" <pk***@hotmail.com> wrote in message
news:elFyudtdFHA.412@tk2msftngp13.phx.gbl...
> what is the mininum and maximum value in SQL statement
>
> select * from table1 where field1 between "minumum" and "maximum"
>
> then it will show up all the value in table1
>
> thank
>
> regards
>
>

Bookmark and Share