ASP Forum
ASP sql subtruction MS Access Database
jerrold | Posted 2:08am 4. May 2010 Server Time |

please hel me.. Please



i have two table

1) Table1
field name
1) FreeBag = 100
2) BuyBag = 50
the total is 150

2) Table2
field name
1) DeliveredBag = 200

i wat to subtract 200-150 the output is 50

this is my code

<table>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "FILEDSN=c:/dsn/MyTable_dsn.dsn"
SQL_query = "SELECT SUM(BuyBag+FreeBag-DeliveredBag)AS Total FROM Table1, Table"



Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
%>
  <tr>
    <td>Total Bag Remain</td>
    <td><%=RS("Total")%>&nbsp;</td>
  </tr>
<%
RS.MoveNext
WEND
RS.Close
MyConn.Close
%>
</table>

what is the wrong of my code?
Please help me... Thank you..



Reply to Post ASP sql subtruction MS Access Database



Back to Forum Page