sql语句 四表联查

 
  
header("Content-Type: text/html;charset=utf-8"); 
$mysql_server="xxxxx";
$mysql_username="xxxxx";
$mysql_password="xxxx";
$mysql_database="xxxxx";
//建立数据库链接
$conn = mysql_connect($mysql_server,$mysql_username,$mysql_password) or die("数据库链接错误");
//选择某个数据库
mysql_select_db($mysql_database,$conn);
mysql_query("set names 'utf8'");
//执行MySQL语句
//提取数据\\
$v=$_POST['value'];
/*$re=mysql_query("SELECT  distinct user_apps.app_name,ald_session_logs.version FROM user_apps LEFT JOIN ald_session_logs ON user_apps.app_key=ald_session_logs.app_key WHERE app_name LIKE '%$v%'");
$res=mysql_query("SELECT aladdin_user.id,aladdin_user.name,aladdin_user.company,user_app_relations.app_key FROM aladdin_user LEFT JOIN user_app_relations ON aladdin_user.id=user_app_relations.aladdin_id");*/

$re=mysql_query("SELECT distinct user_apps.app_name,ald_session_logs.version,aladdin_user.id,aladdin_user.name,aladdin_user.company,user_app_relations.app_key FROM user_apps LEFT JOIN ald_session_logs ON user_apps.app_key=ald_session_logs.app_key LEFT join user_app_relations ON ald_session_logs.app_key=user_app_relations.app_key LEFT JOIN aladdin_user ON user_app_relations.aladdin_id=aladdin_user.id WHERE user_apps.app_name LIKE '%$v%'");


if(mysql_num_rows($re)<=0) exit('0');
echo '';


你可能感兴趣的:(redis)