|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
minumn and maximumwhat 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 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. -- Show quoteHide quoteShai "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 > > > 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 > > select * from table1 where field1 >= 5 and field1 <= 11
I think this is what you are looking for. 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 > > > " AAA" <pk***@hotmail.com> wrote in message select * from table1 where field1 between 1 and 10.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 > > 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 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 > >
Other interesting topics
DataTable.Select method bug in .Net Framework 1.1 SP1
Is this a good application Design? Operator '=' on System.DateTime and System.Double sqltransaction from mm/dd/yyyy to yyyy/mm/dd CancelCurrentEdit doesn't OleDb: Get Properties Datasets and identities in ADO.NET 2.0 ado.net unable to connect from Windows 2000 after SQL server Resta Oracle and .NET stored procedures returning dataset... |
|||||||||||||||||||||||