How do I change this query? <p>How do i change the SELECT query from this:</p> <pre><code>$tre = mysql_query("SELECT System_id, Full_name FROM accounts WHERE Full_name LIKE '". mysql_real_escape_string($_GET['q'])."%' LIMIT 5"); </code></pre> <p>To having this query below in $tre:</p> <pre><code>SELECT DISTINCT contacts.friend_id, accounts.full_name, accounts.system_id FROM contacts, accounts WHERE (contacts.system_id = '$sid' AND contacts.friend_id = accounts.system_id) OR (contacts.friend_id = '$sid' AND contacts.system_id = accounts.system_id) </code></pre> <p>I want the to place the second query inside of $tre = mysql_query(); </p> <p>I am having trouble doing so because the second query has brackets in them and being new i am not sure how to do it correctly.</p>