存储过程连接转换为PHP

时间:2022-09-21 00:09:32

I have a T-SQL stored procedure join which I need to convert to a MySQL join. I'm not sure of the exact syntax.

我有一个T-SQL存储过程连接,我需要转换为MySQL连接。我不确定确切的语法。

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

2 个解决方案

#1


2  

$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    ^      ^

#2


1  

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

我希望wattsure是DB的名字....希望这有助于......

#1


2  

$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    ^      ^

#2


1  

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

我希望wattsure是DB的名字....希望这有助于......