Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery work with localhost and not work in live server
    primarykey
    data
    text
    <p>Everyone, this mysql query is working properly on localhost </p> <pre><code> $query3 = "SELECT tutor_category_subject.subject_id, GROUP_CONCAT( DISTINCT subject.subjects SEPARATOR ', ') AS teaching_subjects FROM tutor_category_subject INNER JOIN subject ON tutor_category_subject.subject_id = subject.subject_id WHERE tutor_category_subject.tutor_id = $teacherId"; </code></pre> <p>But on uploading it to the live server, it's not working and I get this error message. </p> <blockquote> <p>Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause</p> </blockquote> <p>This is my query output without GROUP BY clause. </p> <pre><code> +------------+-------------------------------+ | subject_id | teaching_subjects | +------------+-------------------------------+ | 8 | Art &amp; Craft | | 10 | Buddhism | | 12 | Catholicism | | 14 | Christianity | | 16 | Dancing | | 34 | Accounting | | 37 | Business Studies | | 39 | Conbined Mathematics | | 42 | General Infomation Technology | +------------+-------------------------------+ </code></pre> <p>Can someone tell me what the problem might be?</p> <p>Thank you</p> <p>describe tables</p> <pre><code>mysql&gt; describe tutor_category_subject; +-------------+-----------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------------+------+-----+---------+----------------+ | tcs_id | int(4) unsigned | NO | PRI | NULL | auto_increment | | tutor_id | int(4) unsigned | NO | | NULL | | | category_id | int(2) unsigned | NO | | NULL | | | subject_id | int(4) unsigned | NO | | NULL | | +-------------+-----------------+------+-----+---------+----------------+ mysql&gt; describe subject; +------------+-----------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-----------------+------+-----+---------+----------------+ | subject_id | int(2) unsigned | NO | PRI | NULL | auto_increment | | subjects | varchar(60) | NO | MUL | NULL | | +------------+-----------------+------+-----+---------+----------------+ </code></pre> <p>I need to select subjects to a particular tutor. One tutor could have more subjects. thats why I used 'GROUP_CONTACT()' in my query. Without group by clause query is working in local host. But not in online. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload