Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Union Select Help

Status
Not open for further replies.

anon47

Programmer
Nov 28, 2006
80
US
I am stumped I have a union query that I can't get to work on an asp page I need it to open both tables get a sum from the charge filed and the payment field then subtract the charge form the payments any help would save me a migran.


dim conn, rs, sql, intTelephone, intMobile
set rs = Server.CreateObject ("ADODB.Recordset")
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=F:\Cs\Data\Data.mdb;" & _
"Jet OLEDB:System Database=F:\Cs\Data\Secured.mdw", _
"MyName", "123456"

sql = "SELECT Sum(Charge) AS Charge FROM [Projects] WHERE [Projects].[ClientID]=" &Trim(session("cs_1")) Union Select Sum(Payment) AS Payment FROM [Payments] WHERE [Payments].[ClientID]=" &Trim(session("cs_1"))
rs.open sql, conn
 
Got it thanks guys I used sessions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top