
Originally Posted by
jmurrayhead
Try this:
Code:
SELECT Count(1) as MyCount,performances.performanceid,
shows.showname,
performances.status
FROM shows
INNER JOIN performances
ON shows.showid = performances.showid
WHERE (((performances.status) = "Available"));
GROUP BY performances.performanceid, shows.showname, performances.status
If that doesn't work, post all relevant ASP code for the page.
It does work, but the problem it isnt counting the total records. The expression shows a "1" next to each record in the database(when i test in MS ACCESS) when it should say something like 65!
my relevant code:
Code:
<%
DIM availabilitySQL, availabilityConn, availabilityRS
set availabilityConn=Server.CreateObject("ADODB.Connection")
availabilityConn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0"
availabilityConn.open server.mappath("../db/database.mdb")
'query to check all the shows that are available
availabilitySQL = "SELECT Count(*) as MyCount, performances.performanceID, shows.showName, performances.status FROM shows INNER JOIN performances ON shows.showID = performances.showID WHERE (((performances.status) = ""Available"")) GROUP BY performances.performanceID, shows.showName, performances.status"
Set availabilityRS = Server.CreateObject("ADODB.Recordset")
availabilityRS.Open availabilitySQL, availabilityConn
'response.write availabilitySQL
'testing the
tickets = 800
If CInt(availabilityRS("MyCount")) > tickets Then
Response.Write "There are more than 10 records in the DB"
ElseIf CInt(availabilityRS("MyCount")) < tickets Then
Response.Write "There are less than 10 records in the DB"
End If
%>
Bookmarks