Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Subtracting one return from another

Author  Topic 

Catflea
Starting Member

1 Post

Posted - 2012-06-07 : 11:54:23
I have a search form which returns all the results from the database based on the search criteria...
It returns the "amount" and "amount paid"

As the amount paid gets higher I need the fifth line to subtract one from the other so we can see at a glance what the final figure owed is

Table below
<tr>
<td width='225' valign='top'>£{$row['amount']}<br /><br /></td>
<td width='112' valign='top'></td>
<td width='225' valign='top'>£{$row['amount_paid']}<br /><br /></td>
<td width='112' valign='top'></td>
<td width='225' valign='top'>£{$row['$amount SUBTRACT $amount_paid']}<br /><br /></td>
</tr>

The SQL request is within the search PHP script... can I do this simply with in this line of code?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-06-07 : 14:01:58
will this work?

quote:
Originally posted by Catflea

I have a search form which returns all the results from the database based on the search criteria...
It returns the "amount" and "amount paid"

As the amount paid gets higher I need the fifth line to subtract one from the other so we can see at a glance what the final figure owed is

Table below
<tr>
<td width='225' valign='top'>£{$row['amount']}<br /><br /></td>
<td width='112' valign='top'></td>
<td width='225' valign='top'>£{$row['amount_paid']}<br /><br /></td>
<td width='112' valign='top'></td>
<td width='225' valign='top'>£{$row['$amount'] - $row['amount_paid']}<br /><br /></td>
</tr>

The SQL request is within the search PHP script... can I do this simply with in this line of code?


edit: otherwise post your sql statement please


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -