i am displaying the data retrived from the database in table format.

col1 col2 col3 col4
12 15 15
13 15 16

the data displayed in col1,col2,col3 are retrieved from the database.

now the problem is now i have to compute value for col4 (i.e
col4= (15+15)/4) using the values in col2 ,col3. how to perform this.

i am using sql as backend and jsp for front end.

please send some similar examples or working code for this or
any suggestions are appreciated.

Thanks and regards

9 Years
Discussion Span
Last Post by akash_msrit

Well you can do arithmetic within the sql queries if you like, but seeing as though you already query for col1~3 just store them into int variables. I think your result set will save Strings, so use Integer.parseInt("...") this is off the top of my head so it may be mistyped. Sorry I don't have examples, but if you want them, I will do some up later.


thanks for the reply and advise, can u explain me the same in detail.
its urgent. i want to submit this.

Regards and thanks


Why people never learn or why they are so ignorant? In your other post assing table values to an array I told you to read something which clearly state that

We'll help you get started, exchange algorithm ideas, how-to's, etc. but only if you show that you're willing to put in effort as well.

Here are some examples on SQL qeuries and you better start doing your part of job! ! !

Till he start to do something, please nobody give him any code



sorry if i commited any mistake, very very sorry for the mistake.

if u think that i am not trying its absolutely wrong. i am working more than 12 hrs/per day. do u know why i am posting in this forum,
i am new to html and mysql. before i am working on c, c++.

when try to do myself i am getting new problems every time.
any way if i have disturbed you very very sorry for that.


This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.