Print Page | Close Window

SQL Statement

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=16665
Printed Date: 28 March 2026 at 9:03am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: SQL Statement
Posted By: padoxky
Subject: SQL Statement
Date Posted: 23 September 2005 at 9:19am
Well, i don't know hw to explain it but,
I did something like this
 
sql = "select 50 + amount_paid From tbl1 where id=" & userID
 
Where 50 is a fixed amount and amount_paid is a tbl field in dbase
 
So, whenever you want to view user's records it will addup the amount
Asuming, if the user enter $100 in the form. When selecting to  view the sql we run to add 50 + 100 which will displayed  $150
 
But is not working. Please help me out.


-------------
NgWebDesigns



Replies:
Posted By: michael
Date Posted: 26 September 2005 at 1:09pm

This will depend on the data type you have amount_paid in. Don't use money or so. If amount_payed is numeric, float or so, it should work fine. Also, they way you do it will no generate the right column name do something like

Select 50 + amount_paid as adjusted_paid from tbl1......
and then select it with rs("adjusted_paid")


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: padoxky
Date Posted: 27 September 2005 at 1:00pm

the data type is text

Note am using access database
but let me try this.


-------------
NgWebDesigns


Posted By: Mart
Date Posted: 27 September 2005 at 1:10pm
Why are you storing an Integer in a text field? Use a Number field instead



Posted By: padoxky
Date Posted: 27 September 2005 at 1:37pm
Let me try that also
thanks


-------------
NgWebDesigns


Posted By: padoxky
Date Posted: 28 September 2005 at 6:39am
Still not working.

-------------
NgWebDesigns


Posted By: Mart
Date Posted: 28 September 2005 at 6:58am
How about:

SELECT (SELECT amount_paid FROM tbl1) + 50 As adjusted_paid

Or if that doesn't work just use

SELECT amount_paid FROM tbl1

then when you loop through records use:

Dim adjusted_paid
adjusted_paid = CInt(rs("amount_paid")) + 50


Posted By: michael
Date Posted: 28 September 2005 at 6:52pm
Originally posted by padoxky padoxky wrote:

Still not working.
 
More details please and if you have to paste the whole structure here, what we posted DOES work if you do it right but we cannot help with that little detail....


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net