How to modify this SQL statement-php Tutorial

Source: Internet
Author: User
How can I modify this SQL statement? SQLcodeSELECTsi. user_idFROMecs_store_infoASsiWHEREsi.store_namelike (SELECTwl. mechanism) is how to use the SQL statement selec after like is critical. how can I modify it?
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)
Is how to use the select statement after the like key

------ Solution --------------------
I understand the concept of LZ, but like is a fuzzy match of a string of characters. If you want to fuzzy match any one of the many characters in LZ, you can only use in or use PHP to traverse the results and then re-run the SQL statement. I have never seen how to implement it in one SQL statement, but I don't know how to do it.
------ Solution --------------------
Using the following sentence, I can test it in Oracle:
Select * from users u where u. name like '%' | (select name from users where id = 1) | '% ';
------ Solution --------------------
LS. if only one unique data record can be retrieved from the subquery, the LZ problem is not a problem.

The key to the problem is that the LIKE matches a result set... I just checked that mysql functions cannot fuzzy match a string of characters.

You should give up on LZ. you 'd better change the writing method, because even if you use SQL statements, the efficiency will be surprisingly low.
------ Solution --------------------
Discussion
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)
Is how to use the select statement after the like key

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.