Skip to main content
October 23, 2007
Question

Using data retrieved from a join

  • October 23, 2007
  • 2 replies
  • 294 views
I have a JOIN that returns a column from a table outside of the defined recordset. I want to display the column data but not be forced to also create the column in the recordset table. Is there a way to create a variable so I can use the data in my form and also pass in an URL, etc?
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

October 24, 2007
Do you mean a UNION ALL statement where you combine data from two tables in the same database?

In ASP/SQL, that would look like this:

<%
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_connectionname_STRING
rs.Source = "SELECT id, variable1, variable2, variable3 FROM DatabaseTable1 WHERE Blah Blah Blah UNION ALL SELECT id, variable1, variable2, variable3 FROM DatabaseTable2 WHERE Blah Blah Blah"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.Open()
rs_numRows = 0
%>

This will combine records from both tables and give you results. You use one recordset to do it. Keep in mind, you have to list all the variables you want to pull (no *)

Inspiring
October 23, 2007
I'd love to see the SQL you're talking about as I don't understand what
you mean by "outside of the defined recordset"

Paul Davis
http://www.kaosweaver.com/
Visit us for dozens of useful Dreamweaver Extensions.

http://www.communitymx.com/
Partner at Community MX - Extend your knowledge

davidbarrackphoto wrote:
> I have a JOIN that returns a column from a table outside of the defined
> recordset. I want to display the column data but not be forced to also create
> the column in the recordset table. Is there a way to create a variable so I
> can use the data in my form and also pass in an URL, etc?
>