Home Backend Development PHP Tutorial 这个sql语句该如何修改下

这个sql语句该如何修改下

Jun 13, 2016 am 10:00 AM
from like select store where

这个sql语句该怎么修改下?

SQL code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->SELECT si.user_id FROM ecs_store_info AS si WHERE si.store_name like (SELECT wl.store_name FROM ecs_wpaqq_log AS wl WHERE wl.lngShopId=0)
Copy after login
就是如何在like关键后使用select语句

------解决方案--------------------
LZ的想法我大致明白,但是like是模糊匹配一串字符。LZ如果是想在很多个字符里面,随便模糊匹配任意一个,只能用in或者通过PHP遍历结果然后重新sql,这个目前没见过如何在一条sql里面实现的,不过应该有大神能做到吧,这我就不清楚了。
------解决方案--------------------
用下面这句,我在Oracle里面测试是可以的:
select * from users u where u.name like '%'||(select name from users where id=1)||'%';
------解决方案--------------------
LS,如果子查询中只能取出唯一一条数据,那么LZ的问题就不是问题了。

问题的关键就在于他LIKE中匹配的是个结果集...我刚才查了下,mysql中的函数也没有能模糊匹配一串字符

的,LZ你放弃吧,最好换写法,因为就算用sql语句实现了,效率也会出奇的底下。
------解决方案--------------------
探讨
SQL code
SELECT si.user_id FROM ecs_store_info AS si WHERE si.store_name like (SELECT wl.store_name FROM ecs_wpaqq_log AS wl WHERE wl.lngShopId=0)
就是如何在like关键后使用select语句
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

Video Face Swap

Video Face Swap

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

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)

How to hide the select element in jquery How to hide the select element in jquery Aug 15, 2023 pm 01:56 PM

How to hide the select element in jquery: 1. hide() method, introduce the jQuery library into the HTML page, you can use different selectors to hide the select element, the ID selector replaces the selectId with the ID of the select element you actually use; 2. css() method, use the ID selector to select the select element that needs to be hidden, use the css() method to set the display attribute to none, and replace selectId with the ID of the select element.

Asynchronous processing method of Select Channels Go concurrent programming using golang Asynchronous processing method of Select Channels Go concurrent programming using golang Sep 28, 2023 pm 05:27 PM

Asynchronous processing method of SelectChannelsGo concurrent programming using golang Introduction: Concurrent programming is an important area in modern software development, which can effectively improve the performance and responsiveness of applications. In the Go language, concurrent programming can be implemented simply and efficiently using Channels and Select statements. This article will introduce how to use golang for asynchronous processing methods of SelectChannelsGo concurrent programming, and provide specific

Microsoft Store cannot be opened and displays 'Sorry! Something went wrong, but we got it right' - [Detailed Solution] Microsoft Store cannot be opened and displays 'Sorry! Something went wrong, but we got it right' - [Detailed Solution] Mar 27, 2024 pm 01:21 PM

Some users want to find their favorite apps in the Microsoft Store and download and install them, but find that the Microsoft Store cannot be opened, and it also prompts "Sorry! Something went wrong, but we did it right." So how should we solve it so that it can be opened? Is the Microsoft Store back up and running? The editor has compiled two methods below, I hope they can help you very well! Method one can press Win+R→enter cmd and then hold down ctrl+shift→click OK (click Yes after UAC pops up) and then the cmd window pops up (administrator mode) and then copy and paste the following content: netshwinsockresetnetshintipresetipconfig/releaseipconfig/renewi

How to implement change event binding of select elements in jQuery How to implement change event binding of select elements in jQuery Feb 23, 2024 pm 01:12 PM

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

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 is the reason why Linux uses select? What is the reason why Linux uses select? May 19, 2023 pm 03:07 PM

Because select allows developers to wait for multiple file buffers at the same time, it can reduce IO waiting time and improve the IO efficiency of the process. The select() function is an IO multiplexing function that allows the program to monitor multiple file descriptors and wait for one or more of the monitored file descriptors to become "ready"; the so-called "ready" state is Refers to: the file descriptor is no longer blocked and can be used for certain types of IO operations, including readable, writable, and exceptions. select is a computer function located in the header file #include. This function is used to monitor file descriptor changes—reading, writing, or exceptions. 1. Introduction to the select function. The select function is an IO multiplexing function.

What is the difference between MySQL's REGEXP and LIKE? What is the difference between MySQL's REGEXP and LIKE? May 30, 2023 pm 01:58 PM

1. The difference in matching content. LIKE requires that the entire data must be matched. With Like, all the contents of this field must meet the conditions; REGEXP only requires partial matching, and only one fragment needs to be satisfied. 2. Differences in matching positions: LIKE matches the entire column. If the matched text appears in the column value, LIKE will not find it and the corresponding row will not be returned (unless wildcards are used); REGEXP is within the column value. A match is performed. If the matched text appears in the column value, REGEXP will find it, the corresponding row will be returned, and REGEXP can match the entire column value (same effect as LIKE). 3. The SQL statement returns data that differs from LIKE matching: the SQL statement

How to use the select syntax of mysql How to use the select syntax of mysql Jun 01, 2023 pm 07:37 PM

1. Keywords in SQL statements are not case-sensitive. SELECT is equivalent to SELECT, and FROM is equivalent to from. 2. To select all columns from the users table, you can use the symbol * to replace the column name. Syntax--this is a comment--query out [all] data from the [table] specified by FEOM. * means [all columns] SELECT*FROM--query out the specified data from the specified [table] from FROM Data of column name (field) SELECT column name FROM table name instance--Note: Use English commas to separate multiple columns selectusername, passwordfrom

See all articles