Folks,
I need some help. I have a query that outputs properly in SQL Query Analyzer but doesn't output properly in CFML.
Here's my query:
PS:....I've tried INNER JOIN, LEFT JOIN & RIGHT JOIN....
Now the output line of code:
Here's what goes on. If a class was created with a 10 seat limit and no one registered, it does not display the number 10 or 25 or whatever was set when the class was created. However, when a person DOES register for the class, now the 10 seat class displays 9 and so on. I basically get a blank cell when no one has registered.
I'm not sure if this is a SQL question and should I post it out there? I thought it was a CFML question which is why I posted here.
rojas1mg - - - I love Tek-Tips and all members who reply.
I need some help. I have a query that outputs properly in SQL Query Analyzer but doesn't output properly in CFML.
Here's my query:
Code:
<!---This query will count the number of seats available--->
<cfquery name="countseats" datasource="#dsource#">
SELECT c.course_id, c.course_label, c.course_instructor, c.course_location, c.course_hours, c.course_seats, #getcourses.course_seats# - Count(r.course_id) as seats_left
FROM tbl_course C
INNER JOIN tbl_registration R on c.course_id = r.course_id
WHERE r.course_id = #getcourses.course_id# AND course_disabled=0
GROUP BY c.course_id, c.course_seats, c.course_label, c.course_instructor, c.course_location, c.course_hours
</cfquery>
Now the output line of code:
Code:
<TD align="center"><cfif countseats.seats_left eq 0><font color="##FF0000"><B>Full</B></font><cfelse>#countseats.seats_left#</cfif></TD>
Here's what goes on. If a class was created with a 10 seat limit and no one registered, it does not display the number 10 or 25 or whatever was set when the class was created. However, when a person DOES register for the class, now the 10 seat class displays 9 and so on. I basically get a blank cell when no one has registered.
I'm not sure if this is a SQL question and should I post it out there? I thought it was a CFML question which is why I posted here.
rojas1mg - - - I love Tek-Tips and all members who reply.