Select Highest Value For Each Field?

I've got a database that has 5 numeric values for each record. I'm trying to figure out how to have the records sorted alphabetically, but highlight the highest value in the table for each column. So in other words, the table shows up with one record in each row, with a total of 6 columns (the name plus 5 columns). I want the highest value in each column to be emphasized.

So the final product would end up looking like the code at the bottom of this message.

I've pulled the records from the Access database and am able to sort them alphabetically and get the table to appear. What I was thinking is that at the top I'd define variables that correspond to the highest record for each column. Then in the table code I'd set the colour of each cell using an 'if then'.

So I have 3 specific questions:

- Is that the best way to do it? I don't want the page to take 20 minutes to load because I'm overloading the server.

- how would you set the variables at the top of the page?

- how would you write the if then in the middle of the table to change the background colour of the cell if that value (or values, in case there's a tie) is the highest of all the records? Code:

View Replies


ADVERTISEMENT

Select Only The First Few Words Of A Record Field.

Say I have a field containig some text, for example: The quick brown fox jumped over the fence. How do I only show the first 4 words of the sentance, i.e: The quick brown fox...

View Replies View Related

Posting A Value For A Field In Select Option

I have an ASP admin script where I'm adding records, and I have a
category that already has set name values hard-coded into a selct option
pulldown, but if the user wants to create a new category and not use the
select pulldown, the value will end up being " , newvalue" when posting
from this sequence of pulldown and input text box:

<select name="CategoryName">
<option selected></option>
<option value="first">first category</option>
<option value="second">second category</option>
</select>
<br>
New Category<br>
<input name="CategoryName" type="text" size="26"
maxlength="255">

What is the best way of not having that extra preceeding comma appear as
the value if the user chooses to add a brand new category?

View Replies View Related

Return Highest Value

How do you return the highest value in a recordset of maybe 100 records?Is it necessary to run 2 recordsets?I was hoping it was as simple as Max([Price]), but no luck.

View Replies View Related

Returning Highest Occuring Value

i am trying to pull from my mySQL database the highest ocurring value of one field.

example:

name / value

peter / 6
alex / 7
ethan /5
thomas / 6
brett / 7
ryan / 6
albert / 6

if this was a table, i need to get "6"

I am fairly familiar with asp, but with non-traditional training.

View Replies View Related

Highest Number In DB Column

I'm so full of questions these days. I've got a hidden input in a form that I want to be set to 1 more than the highest number in the colum "userid" of my table "users" in my database.

Is this possible? If so, how?

Code:

<%
dim userid

userid = MaxNumberInDB + 1
%>

<input name="userid" type="hidden" value="<%=userid%>" />

Like that, but how would you find the "MaxNumberInDB" ?

View Replies View Related

SELECT Statement Pulls Field Names - How To Avoid?

I do a SELECT * from table command in an ASP page to build a text file
out on our server, but the export is not to allow a field name rows of
records. The first thing I get is a row with all the field names. Why
do these come in if they are not part of the table records? How do I
eliminate this from being produced? Code:

View Replies View Related

Freeaspupload: Retrieving Multiple Values From A Select Field

I'm having problems retrieving all the values from a multiple selection field using the freeaspupload component.

I'm creating an online email app that uses the freeaspupload to add attachement functionality, which means the form encoding type is multipart/form-data. I've done something similar with the persits aspupload component, and had no problems with that, but the freeaspupload version seems to handle <select> fields slightly differently. Code:

View Replies View Related

Choosing The Highest From Multiple Fields Not Rows.

I have multiple fields (BLM, WHM, RNG, MNK) each with a numeric value. How can I search across these fields for each record and find the highest number.

Example:

Name BLM WHM RNG MNK
----------------------------------
Jason 19 52 33 18

What I want it to do is return and display Jason WHM 52

And I want to do this for every record in the table.

View Replies View Related

Using Vbscript "SPLIT" Function On Multi-select Field

I am trying to split a mgrgroup field to extract the MD codes. It correctly grabs the MD codes if all records in a mass update are updated, but if only one record in the loop is updated then it puts the last 5 digits of the mgr name in the MD field.

THIS IS THE CODE: ....

View Replies View Related

Using Vbscript "SPLIT" Function On Multi-select Field

I am using the following code to split/join values in a multi-select field. It is combining all the values in All the records into one long string in each record in recordset.

Example: I have a recordset with 2 records. The 1st contains the split/joined values: Alan Smir, Jeff Karl The 2nd contains the value: Keith Robb

When it updates database, it will put Alan Smir, Jeff Karl, Keith Robb into each record in the recordset. Instead it should be putting Alan Smir, Jeff Karl into the 1st record
and Keith Robb into the 2nd record in the recordset.

Does anyone see what is wrong with the code ....

View Replies View Related

Select Statement Comparing Date() & Date Field Of Database

i'm new here and i'd like to ask if there's someone who knows how to compare date() function and date from database with date/time type inside select statement so i don't have to do if..then..else

View Replies View Related

LEFT JOIN On A Date Field And A Numerical Field - Using WHERE Clause

I am using a Relational database for my site and i have the following tables:

FIXTURES, GAMEDATES

the fields in FIXTURES are:

GameDate
Home
Away

(All of the above are numerical fields)

the fields in GAMEDATES are:

DateID(integer)
GameDate(#Date Field#)

What i have done is in the GAMEDATE field in the FIXTURES table i have used the ID number of the date that i wish to assign to that record - using a LEFT JOIN to display the actual date that is pulled from the GAMEDATES table (That which corresponds to the relevant id used in Fixtures)

The problem is that in some of my code i want to display records using sql and sometimes in the where clause i use the following:

WHERE Fixtures.GameDate<=(Date())

obviously meaning WHERE GAMEDATE is LESS THAN or EQUAL to TODAY.

The thing is when i use the join it does not use the where clause and displays all of the records in the FIXTURES table.

Does any one know how to get around this, i have not received any error messages it just isnt displaying the right data

View Replies View Related

Comparing Field Data From Previous Field

Im comparing values in a field while doing a loop if sAct<>myData(5,i) then At the end of the loop I make the value of sAct equal the current myData

This will work when comparing other fields withing my recordset (so I know the statement works) but it will not work for the field I want to compare. The only difference with this field is that it has null values. Could this be the problem? if so, how do I deal with nulls?

View Replies View Related

Error Using <select></select>

I have written some code which should dynamically build a table which is then populated with questionas and possible answers. The format of the answers will vary ie they may be in the form of a radio button which will be rated from 1-5, checkbox or a selectbox.

The first problem I have is if I do not comment out <select></select> I get an error message saying the page can not be found. when I do take it out I get asp timeout. Code:

View Replies View Related

Fill Field Based On Another Field

I have a input form with 5 fields. One of the fields is MajorNo and the other is named Description.

I have a reference table in my MS Access database (tblMajor)that lists the major numbers and their descriptions.

I would like to have the description field in my ASP automatically filled based on the major number entered on the form, so the user will only need to input the major number when submitting to the Access table (tblSalesTotal).

View Replies View Related

Pass Hidden Form Field Value To Another Form Field To Insert In Db

I am trying to pass a hidden field value on a form into another field on the
form so that it can then be inserted in the database, to enable me then to
reference that number at a later date.

(The hidden value (1 for example) would then automatically get passed to the
other input field.)

The code for the text field that allows users to type an number into it for
submission to the db is below, but what code do i need within the hidden
field to populate this text field below so that users do not have to type the
number in? Code:

View Replies View Related

How Can I Change One Line Input Field Into Larger Input Field

I have being working with making an edit field over the past few days. The edit function is now working fine. The edit fields that i have are for id, subject, notes, timedate.

All of the edit screens are one line text screens. What I want to do now is increase the size of the notes box to a larger textarea type box to make it easier to edit notes. The notes field in the db is a textarea field. Code:

View Replies View Related

Automated "state" Field From "Country" Field

When you select the "Country" field in a Hotmail "get new account" link, the field "State" changes automatically, giving you the correct States that belongs to the chosen Country.

View Replies View Related

Request.Form("Field Name") Versus Request.QueryString("Field Name")

I want to know what's the differences between

Request.Form("Field Name") and
Request.QueryString("Field Name")

OR they function exactly the same, which is to return the value of the
field??

View Replies View Related

Select

does anyone know what I have wrong with this select in my form?

<%
sql = "SELECT * FROM [LTAB_CAProcessArea]"
Set ProcessAreaRS = Server.CreateObject("ADODB.Recordset")
ProcessAreaRS.Open sql, SessionCPRDBConnection, adOpenStatic, adLockOptimistic, adCmdText
%>

<select name="processarea">
<%
Do While Not ProcessAreaRS.EOF
Resonse.Write("<option name='" & ProcessAreaRS("processareaID") & "'>")
Response.Write(ProcessAreaRS("txtProcessArea"))
Response.Write("</option>")

View Replies View Related

<select> Help

I don't know if this is in the right section. I hope it is.I have an HTML document that uses tables and stuff. I also have a FORM on there with some input boxes, Radio buttons and <select> options.
I have a .asp VB file also that processes the actual form and writes the answered questions to a text file on the server (tab separated)
My problem:
The input boxes and radio buttons work fine. It writes to the text file on the sever end.

My problem is I am not too sure how to go making the answers from the <select> options to also write to the server. They way I have it set up right now, it jsut writes "NULL" on the text file.

View Replies View Related

SELECT Last Vs SELECT Max

I've recently come across using "Select Last" in an sql query. Does anyone have any info or views on using it? Until now I've relied on "Select Max" but Select Last would have distinct advantages when using random autonumbers. I'm also curious about why there is so little info on it - perhaps I'm looking in the wrong places?

View Replies View Related

[Select][Value]

I want to display an editable page extract from MS Access table. Now I want to show the value in Select list, extract from another table. Both tables are joinable with the foreign key.

In simplest, I want to extract and display the exact value from a table and show in Select list for edit.

I could not think of any way. I can bring up data and display in Select list but it would display the first value in the list only.

View Replies View Related

Select

i want to select all ids from table1 where those id's arent in table2
Sounds simple and iam sure could be possible in a single sql statement

View Replies View Related

SELECT TOP 50

I have the following SQL SELECT statement below that doesn't like the TOP 50 parameter. When I remove it, all is good. When I put it back I get "Incorrect syntax near '50'".
Code:
SELECT TOP 50 SSN, LName, FName, License_Certificate, Character_Identifier, CertificateNo, " & _
"tblIndividualInfo.IndividualID, tblLicense.LicenseID FROM tblIndividualInfo " & _
"INNER JOIN (tblLicense INNER JOIN stblLicenseType ON tblLicense.LicenseTypeID = stblLicenseType.ID) ON " & _
tblIndividualInfo.IndividualID = tblLicense.IndividualID " & strWhere & " ORDER BY LName, FName

View Replies View Related

Select Box

how to insert multiple items in a select box into a database. For example:

<select multiple name="ComservGroupAge" size="3">
<option value="Children">Children </option>
<option value="Adolescents">Adolescents </option>
<option value="Adults">Adults </option>
<option value="Does Not Matter">Does Not Matter</option>
</select>

I don't want it to go into my db column as one long field.

View Replies View Related

Select Sum

for this part. can i use

select sum (orderqty) from custorder

i attach a pic file to show wat i wanted to do
a few data will be listed out
i want the total from that particular few records only. not the whole records in database

View Replies View Related

SQL SELECT

I know this is an ASP forum but I've also gotten answers to my SQL problems here and I'd appreciate your help very much.
I have these two tables in SQL. Both tables have the same two columns (Description and SiebelName). I want to some how write a script that will look for the descriptions that matches the ones in Table1 with the ones in Table2 and if there are any I would like to take the column in Table2, SName, and update the column in Table1, SiebelName, with that of Table2.
Here's what I attempted to do but it's not working:
--------------------------------
UPDATE tbl_MasterTEST
SET tbl_MasterTEST.SiebelName = Siebel.SName WHERE (SELECT tbl_MasterTEST.ProdDesc, tbl_MasterTEST.SiebelName, Siebel.SDesc, Siebel.SName
FROM tbl_MasterTEST, Siebel
WHERE tbl_MasterTEST.ProdDesc = Siebel.SDesc)

View Replies View Related

For Each And Select

strSQL = "SELECT * FROM mod48 WHERE N_GEN = 5"
oRs.open strSQL,oConn,3

this table has alot of fields. I want it to automatically create alot of Text boxes for each field. But i also need the fields names. The only thing is that the field names in the table are well not very user friendly.

n_gen = General Numer
pa_name = Client Name
pa_surname = Client SurName

So i was wondering is there something i can do. Like a For each that will create alot of tect boxes for each field "with its value in it" and also make it write a description for the lable. Code:

View Replies View Related

Select Max 2x

Ik want to select 2 MAX values form one table, but i don't know how that works, and i can't find it anywhere.

This is what i got so far:

sql = "SELECT max(tekstindex), max(volgnummer) FROM menu"

I want to select max(tekstindex) as 'tekst' and max(volgnummer) as 'volg'.

View Replies View Related

Select

I have a select statement that searches for certain records within a date range entered through a form. what i need to do on another page is count how many records they are and split them into each day within that date range. My original select query is:
Code:


objRSError.Source = "SELECT TOP 100 PERCENT TrapPage, TrapLine, COUNT(TrapID) AS ErrorVol, TrapDescription, TrapASPDescription, TrapCategory FROM dbo.tblErrorTraps WHERE (TrapTime >= CONVERT(DATETIME, '" & objRSError__strFrom & "', 103)) AND (TrapTime <= CONVERT(DATETIME, '" & objRSError__strTo & "', 103))GROUP BY TrapPage, TrapLine, TrapDescription, TrapASPDescription, TrapCategory ORDER BY COUNT(TrapID) DESC"

View Replies View Related

Select

For instance i do write out such which works.Code:

SELECT TOP 5 * FROM table4 order by id desc

Now how would i select the rest of the records without the first 5.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved