开发者

Stored procedure join converted to PHP

开发者 https://www.devze.com 2023-04-12 19:21 出处:网络
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.

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号