I have a T-SQL stored procedure join which I need to convert to a MySQL join. I'm not sure of the开发者_C百科 exact syntax.
T-SQL code:
SELECT username
FROM wattsure..be_user_profiles bup
JOIN wattsure..be_users bu
ON bup.user_id = bu.id
WHERE company_name = @installer
AND [group] = 6
$param = mysql_real_escape_string($param);
//at the least, or use PDO.
$query = "SELECT username
FROM wattsure.be_user_profiles bup
INNER JOIN wattsure.be_users bu
ON bup.user_id = bu.id
WHERE company_name = '$param' AND `group` = '6' ";
//Don't forget these quotes ^ ^
SELECT username FROM wattsure.be_user_profiles bup
INNER JOIN wattsure.be_users bu
ON bup.user_id = bu.id
WHERE company_name = '$var'
AND `group` = 6
I hope wattsure is DB name.... Hope this helps...
精彩评论