单表多条件筛选交集60分在另外的板块,完成进去另外领分
这是数据表
BuyID AttributeID Value
1 1 单间出租
1 2 0
1 3 1
1 4 1000
2 1 整套出租
2 2 地址
2 3 1
2 4 1000
3 1 单间出租
3 2 9
3 3 10
3 4 1500
条件一:`AttributeID`=1 AND `Value`='单间出租'
条件二:`AttributeID`=4 AND `Value`>=1000 AND `Value`
我改如何搜索出条件一和条件二的交集呢?
即搜索出的结果只有一条,`BuyID`=1
尝试一:SELECT * FROM jm_user_buy_attribute WHERE (`AttributeID`=1 AND `Value`='单间出租') OR (`AttributeID`=4 AND `Value`>=1000 AND `Value`尝试一搜索出来的结果只是满足条件一或者条件二的结果,但不能筛选出交集。
尝试二:SELECT * FROM jm_user_buy_attribute WHERE (`AttributeID`=1 AND `Value`='单间出租') OR (`AttributeID`=4 AND `Value`>=1000 AND `Value`尝试二搜索出来的结果只是去除了相同的BuyID
尝试三:SELECT * FROM jm_user_buy_attribute as b1 left join jm_user_buy_attribute as b2 on b1.BuyID=b2.BuyID where b1.AttributeID=1 AND b1.Value='单间出租' OR b2.AttributeID=4 AND b2.Value>=1000 AND b2.Value尝试二搜索出来的结果不正确。
http://bbs.csdn.net/topics/390325234
这是我在MYSQL板块那里发布过的!
解决问题后可以请进去领分
------解决方案--------------------
单独 select * from jm_user_buy_attribute where AttributeID=1 AND Value='单间出租'
得
Array
(
[0] => Array
(
[BuyID] => 1
[AttributeID] => 1
[Value] => 单间出租
)
[1] => Array
(
[BuyID] => 3
[AttributeID] => 1
[Value] => 单间出租

PHPisusedforsendingemailsduetoitsintegrationwithservermailservicesandexternalSMTPproviders,automatingnotificationsandmarketingcampaigns.1)SetupyourPHPenvironmentwithawebserverandPHP,ensuringthemailfunctionisenabled.2)UseabasicscriptwithPHP'smailfunct

The best way to send emails is to use the PHPMailer library. 1) Using the mail() function is simple but unreliable, which may cause emails to enter spam or cannot be delivered. 2) PHPMailer provides better control and reliability, and supports HTML mail, attachments and SMTP authentication. 3) Make sure SMTP settings are configured correctly and encryption (such as STARTTLS or SSL/TLS) is used to enhance security. 4) For large amounts of emails, consider using a mail queue system to optimize performance.

CustomheadersandadvancedfeaturesinPHPemailenhancefunctionalityandreliability.1)Customheadersaddmetadatafortrackingandcategorization.2)HTMLemailsallowformattingandinteractivity.3)AttachmentscanbesentusinglibrarieslikePHPMailer.4)SMTPauthenticationimpr

Sending mail using PHP and SMTP can be achieved through the PHPMailer library. 1) Install and configure PHPMailer, 2) Set SMTP server details, 3) Define the email content, 4) Send emails and handle errors. Use this method to ensure the reliability and security of emails.

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

The reason for using Dependency Injection (DI) is that it promotes loose coupling, testability, and maintainability of the code. 1) Use constructor to inject dependencies, 2) Avoid using service locators, 3) Use dependency injection containers to manage dependencies, 4) Improve testability through injecting dependencies, 5) Avoid over-injection dependencies, 6) Consider the impact of DI on performance.

PHPperformancetuningiscrucialbecauseitenhancesspeedandefficiency,whicharevitalforwebapplications.1)CachingwithAPCureducesdatabaseloadandimprovesresponsetimes.2)Optimizingdatabasequeriesbyselectingnecessarycolumnsandusingindexingspeedsupdataretrieval.

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
