0

SELECT * FROM `studentcourse` WHERE `systemcode` = 'ilscorp' AND `status` = 'complete' AND `techcode` IN (SELECT `techcode` FROM `usersubscription` WHERE `subscription_id` = '296')


After I run this the server has an intense lag and needs to be restarted or timeoutes occur.

2
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by peter_budo
0

SELECT * FROM `studentcourse` WHERE `systemcode` = 'ilscorp' AND `status` = 'complete' AND `techcode` IN (SELECT `techcode` FROM `usersubscription` WHERE `subscription_id` = '296')

I don't think you need to use single qoutes on variable names, they are used only on variable values when listed. Your query should be like this

SELECT * FROM studentcourse WHERE systemcode = 'ilscorp' AND status = 'complete' AND techcode IN (SELECT techcode FROM usersubscription WHERE subscription_id = '296')
0

Hey I appreciate the reply, but removing backticks didn't change the behavoir of the query

0

I've tried it in PHPMYADMIN

and in my PHP script:

$select_results = mysql_query("SELECT * FROM `studentcourse` WHERE `systemcode` = 'ilscorp' AND `status` = 'complete' AND `techcode` IN (SELECT `techcode` FROM `usersubscription` WHERE `subscription_id` = '$subid')") or die("<BR>Failed to run MySQL query!<BR>".mysql_error().$form);

phpMyAdmin - 2.9.0.2

MySQL client version: 5.0.24a

PHP Version 5.1.6

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.