Forums

ASP

This topic is locked

HOW TO CALL A QUERY RECORDSET

Posted 11 Jun 2003 15:07:10
1
has voted
11 Jun 2003 15:07:10 Frank Munoz posted:
In the SQL statement when creating a recordset query in Data Bindings...is there a way to call or declare a recordset query that is listed in the data bindings list you've just created, as opposed to tables from a database?

Example: In Data Bindings, I just created a recordset called "Trailers" that uses a table from the database called tblTrailers. I want to create a new recordset query in Data Bindings that will call the query "Trailers" and NOT tblTrailers. My SQL should read:

SELECT Sum(LeaseRate)
FROM Trailers

*Notice how I want FROM to call the listed query in Data Bindings as opposed to a table in my database connection...Is this possible and how can I do it?

Replies

Replied 11 Jun 2003 22:13:30
11 Jun 2003 22:13:30 Brad Hitt replied:
You can go about this 2 ways. The first way is to create a View or Query that is stored in your DB and call on it that way. The second way is to nest your queries, ie, a query inside of a query. That can get complex if you are a novice at writing SQL statements.
Replied 11 Jun 2003 22:33:31
11 Jun 2003 22:33:31 Frank Munoz replied:
Thanks for replying...can you show me an example of a nested query in SQL? Keep in mind I'm using MySQL as my database...
Replied 11 Jun 2003 22:48:31
11 Jun 2003 22:48:31 Brad Hitt replied:
SELECT SUM(tblEmpName.rate * (timesheet.[Administrative Hours] + timesheet.[Coding hours])) AS TotalRate FROM dbo.tblEmpName INNER JOIN dbo.timesheet ON timesheet.Personname = tblEmpName.Name WHERE timesheet.[Case Name] = 'Pogue'

Reply to this topic