$query = mysql_query('SELECT
configuration_httpq.httpq_host,
configuration_httpq.httpq_port,
configuration_httpq.httpq_pass,
configuration_httpq.media_share,
configuration_httpq.httpq_id
FROM configuration_httpq, configuration_session
WHERE configuration_session.session_id = "' . $cfg['session_id'] . '"
AND configuration_httpq.httpq_id = configuration_session.httpq_id
ORDER BY configuration_httpq.name');
How can I change this query so that I also get the first result (ORDER BY configuration_httpq.name) when configuration_session.httpq_id is not equel to any configuration_session.httpq_id?
SELECT
configuration_httpq.httpq_host,
configuration_httpq.httpq_port,
configuration_httpq.httpq_pass,
configuration_httpq.media_share,
configuration_httpq.httpq_id
FROM configuration_httpq LEFT OUTER JOIN configuration_session
ON configuration_httpq.httpq_id = configuration_session.httpq_id
WHERE configuration_session.session_id = "' . $cfg['session_id'] . '"
ORDER BY configuration_httpq.name
Maybe an outer join?
Not sure how you can order by something that is not in the select.