Home Database Mysql Tutorial And,Where使用提示以及用+进行左关联的提示及注意事项

And,Where使用提示以及用+进行左关联的提示及注意事项

Jun 07, 2016 pm 05:56 PM
and where hint

先左关联后在过滤假如关联的结果里面B.b3=null那么你在where后面在加B.b3=2那么结果中B.b3肯定是没有null的情况的,也就是说用+进行左关联没有用leftjoin灵活待后续看是否有什么好的解决方案

1and和where的滥用用的时候请多注意

下面的三段代码的效果肯定是不一样的
(1)
代码如下:
selectA.a1,B.b3
fromAleftjoinB
onA.a2=B.b2
whereA.a3=1
andB.b3=2

先左关联后在过滤假如关联的结果里面B.b3=null那么你在where后面在加B.b3=2那么结果中B.b3肯定是没有null的情况的
(2)
代码如下:
selectA.a1,B.b3
fromAleftjoinB
onA.a2=B.b2
andB.b3=2
whereA.a3=1

关联前先过掉B的b3=2的条件然后再左关联起来那么这个结果可能B.a3会有null的情况的
(3)
代码如下:
selectA.a1,B.b3
fromAleftjoinB
onA.a2=B.b2
andB.b3=2
andA.a3=1

关联前先过掉B中的B3=2和A中的a3=1条件然后再关联起来那么这个结果可能B.b3会有null的情况的

所以大家在用where和and的时候放的位置请多注意了

2用+进行左关联缺陷也许可以有解决方案待后续
(1)
代码如下:
selectA.a1,B.b3
fromA,B
whereA.a2=B.b2(+)
andA.a3(+)=1
andB.b3(+)=2

这个条件应该是和1里面的(1)的情况一样

先左关联后在过滤假如关联的结果里面B.b3=null那么你在where后面在加B.b3=2那么结果中B.b3肯定是没有null的情况的
也就是说用+进行左关联没有用leftjoin灵活待后续看是否有什么好的解决方案
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What should I do if Google Chrome prompts that the content of this tab is being shared? What should I do if Google Chrome prompts that the content of this tab is being shared? Mar 13, 2024 pm 05:00 PM

What should I do if Google Chrome prompts that the content of this tab is being shared? When we use Google Chrome to open a new tab, we sometimes encounter a prompt that the content of this tab is being shared. So what is going on? Let this site provide users with a detailed introduction to the problem of Google Chrome prompting that the content of this tab is being shared. Google Chrome prompts that the content of this tab is being shared. Solution: 1. Open Google Chrome. You can see three dots in the upper right corner of the browser "Customize and control Google Chrome". Click the icon with the mouse to change the icon. 2. After clicking, the menu window of Google Chrome will pop up below, and the mouse will move to "More Tools"

Try new ringtones and text tones: Experience the latest sound alerts on iPhone in iOS 17 Try new ringtones and text tones: Experience the latest sound alerts on iPhone in iOS 17 Oct 12, 2023 pm 11:41 PM

In iOS 17, Apple has overhauled its entire selection of ringtones and text tones, offering more than 20 new sounds that can be used for calls, text messages, alarms, and more. Here's how to see them. Many new ringtones are longer and sound more modern than older ringtones. They include arpeggio, broken, canopy, cabin, chirp, dawn, departure, dolop, journey, kettle, mercury, galaxy, quad, radial, scavenger, seedling, shelter, sprinkle, steps, story time , tease, tilt, unfold and valley. Reflection remains the default ringtone option. There are also 10+ new text tones available for incoming text messages, voicemails, incoming mail alerts, reminder alerts, and more. To access new ringtones and text tones, first, make sure your iPhone

How to handle user input checksum prompts in Vue How to handle user input checksum prompts in Vue Oct 15, 2023 am 10:10 AM

How to handle the verification and prompts of user input in Vue. Handling the verification and prompts of user input in Vue is a common requirement in front-end development. This article will introduce some common techniques and specific code examples to help developers better handle user input verification and prompts. Validation using computed properties In Vue, you can use computed properties to monitor and validate user input. You can define a calculated attribute to represent the value entered by the user, and perform validation logic in the calculated attribute. Here is an example: data(){

Baidu Tieba app prompts that the operation is too frequent, what's the matter? Baidu Tieba app prompts that the operation is too frequent, what's the matter? Apr 01, 2024 pm 05:06 PM

Baidu Tieba app prompts that the operation is too frequent. This prompt is usually to maintain the normal operation and user experience of the platform to prevent malicious screen spam, advertising spam and other inappropriate behaviors. For specific handling methods, you can read the tutorial shared by the editor. Baidu Tieba app prompts that the operation is too frequent. Sharing how to deal with it 1. When the system prompts [Operation is too frequent], we need to wait for a while. If you are anxious, you can do something else first. Generally, after waiting for a while, this prompt message will It will disappear automatically and we can use it normally. 2. If after waiting for a long time, it still displays [Operation Too Frequent], we can try to go to Tieba Emergency Bar, Tieba Feedback Bar and other official Tieba, post to report this phenomenon and ask official personnel to solve it. 3.

How to use the Where method in Laravel collections How to use the Where method in Laravel collections Mar 10, 2024 pm 10:21 PM

How to use the Where method in Laravel collection Laravel is a popular PHP framework that provides a wealth of functions and tools to facilitate developers to quickly build applications. Among them, Collection is a very practical and powerful data structure in Laravel. Developers can use collections to perform various operations on data, such as filtering, mapping, sorting, etc. In collections, the Where method is a commonly used method for filtering the collection based on specified conditions.

A Practical Guide to the Where Method in Laravel Collections A Practical Guide to the Where Method in Laravel Collections Mar 10, 2024 pm 04:36 PM

Practical Guide to Where Method in Laravel Collections During the development of the Laravel framework, collections are a very useful data structure that provide rich methods to manipulate data. Among them, the Where method is a commonly used filtering method that can filter elements in a collection based on specified conditions. This article will introduce the use of the Where method in Laravel collections and demonstrate its usage through specific code examples. 1. Basic usage of Where method

What should I do if it says that the monitor driver has stopped responding and has been restored? What should I do if it says that the monitor driver has stopped responding and has been restored? Mar 14, 2024 pm 02:00 PM

When playing a game, a message "The monitor driver has stopped responding and has been restored" suddenly pops up. What's going on? The display driver has stopped responding and has recovered. This means that the display driver in the system has experienced an abnormal situation and cannot work normally, causing the display to become unresponsive or have a black screen. Common reasons: 1. Monitor driver error: There may be program logic errors or data transmission errors in the driver, causing the driver to fail to work properly. 2. Insufficient hardware configuration: The computer hardware configuration is insufficient to meet the requirements of high-performance applications, resulting in problems such as system pauses and lags. 3. System file damage: damage to computer system files

From beginner to proficient: Master the skills of using is and where selectors From beginner to proficient: Master the skills of using is and where selectors Sep 08, 2023 am 09:15 AM

From beginner to proficient: Master the skills of using is and where selectors Introduction: In the process of data processing and analysis, the selector is a very important tool. Through selectors, we can extract the required data from the data set according to specific conditions. This article will introduce the usage skills of is and where selectors to help readers quickly master the powerful functions of these two selectors. 1. Use of the is selector The is selector is a basic selector that allows us to select the data set based on given conditions.

See all articles