sql-like

any-word search using LIKE %

Deadly 提交于 2019-12-12 03:11:45
问题 I have a database table which has a field firstname and a field lastname . I'm trying to implement an any-word search system using a search box where if let's say that we have a user named John Stanley Smith in the database (where firstname = John Stanley and lastname = Smith ), I want to be able to return John Stanley Smith if the user types any of the following: 1- Any letter which is part of John Stanley Smith (j, s, l, e, y, m, etc...) 2- Any word which is part of John Stanley Smith 3-

Exact match with sql like and the bind

亡梦爱人 提交于 2019-12-12 02:17:15
问题 I have a bind in the SQL query SELECT * FROM users WHERE name LIKE '%?%' the bind set the ? . Now, if i want to search with like method everything work but if, without change the sql, i want to search the exact match i dont now how to do. I tried some regexp int the textbox es: _jon \jon\ [jon] and some others but nothing work properly. Any ideas? 回答1: Change your query to select * from users where name like '?' If you want to do a wildcard match, put the wildcards as part of the string that

android \data\data folder empty

谁都会走 提交于 2019-12-12 02:09:37
问题 i have created a db in the phone and have inserted some values in it as well. now there is a large excel sheet which contains several more records that need to be inserted. i am trying to find the db file in the phone so as to use sql lite db tool to upload some data in it. but the folder is empty. can any one suggest or guide. thanks 回答1: If you are on a real phone the /data folder will appear empty unless you have root access. An application like root explorer can allow you access to these

MySQL QUERY “LIKE” returns nothing

自作多情 提交于 2019-12-11 18:06:31
问题 I'm using MySQL version 5.0.51a and PHP to access the database, and this query returns nothing when it should return at least 2 rows which match the LIKE condition. $result = mysql_query("SELECT * FROM user WHERE name LIKE '%".$search."%'OR email LIKE '%".$search."%' ORDER BY ".$order, $con); The $search variable is ' Name ', there is no problem with ORDER, $order or $con, i've already tried that, and there are 2 rows where the name is 'Name', but somehow it can't find those rows and it

How to select the column names of a table where column data contains '%' in the values?

你离开我真会死。 提交于 2019-12-11 15:31:24
问题 How to select the column names of a table where column data contains '%' in the values? Eg: In the table COMP there are two columns(Addr, Comp_Name) which has data containing '%' in its string. So my query should return those column_names(Addr, Comp_Name) 回答1: I dont get you right but i thing this will help you You can use the escape identifier --Queries -- for % select * from test_a where col1 like '%\%%' escape '\'; --for _ select * from test_a where col1 like '%\_%' escape '\'; 来源: https:/

How to properly implement indexing for use in variable LIKE statement with sqlite3?

孤街醉人 提交于 2019-12-11 15:09:55
问题 I am trying to do some fuzzy matching between two tables. One is a table I have stored locally (9,000 rows), call it table A. The other is stored as a sqlite db (2 million + rows csv), call it table B. Basically, I want to match the column "CompanyNames" from table A with the column "CurrentEntityNames" from table B and use this to left join table B to table A. I am currently able to loop through the LIKE statements, passing a parameter like so: (myNames is just the column CompanyNames from

Microsoft SQL Server does not return everything when using LIKE clause

眉间皱痕 提交于 2019-12-11 10:38:43
问题 I have a Products table in SQL Server 2014 Express with records in it. A few product names (records) are the following: Test product Teszt termék Teszt termék 2 When I execute the following query, everything works just fine: SELECT * FROM Products WHERE name LIKE 'te%' It retrieves all three records. However, when I use SELECT * FROM Products WHERE name LIKE 'tes%' is executed, only "Test product" is retrieved. And when the query is SELECT * FROM Products WHERE name LIKE 'tesz%' then it works

QueryDSL like operation SimplePath

会有一股神秘感。 提交于 2019-12-11 09:59:10
问题 Similarly to this question I would like to perform an SQL "like" operation using my own user defined type called "AccountNumber". The QueryDSL Entity class the field which defines the column looks like this: public final SimplePath<com.myorg.types.AccountNumber> accountNumber; I have tried the following code to achieve a "like" operation in SQL but get an error when the types are compared before the query is run: final Path path=QBusinessEvent.businessEvent.accountNumber; final Expression

Can I make Entity Framework use sqlite's LIKE instead of instr()?

谁都会走 提交于 2019-12-11 09:45:56
问题 Currently using .NET Core 2. I use a LINQ query similar to: var peopleInRoseStreet = context.Person .Include(p => p.Addresses) .Where(p => p.Addresses.Any(a => a.Text.Contains("rose"))); EF seems to translate this to: SELECT "p".* FROM "Person" AS "p" WHERE EXISTS ( SELECT 1 FROM "PersonAddress" AS "a" WHERE (instr("a"."Text", 'rose') > 0) AND ("p"."Id" = "a"."person_id")) ORDER BY "p"."Id" By using instr() , the comparison is case-sensitive although the PersonAddress.Text column is set to

MySQL and LIKE comparison with %

半世苍凉 提交于 2019-12-11 08:58:05
问题 If someone passes a '%' to a field that compares in my sql with su.username LIKE CONCAT('%', email ,'%')) it returns all rows. It ends up looking like su.username LIKE CONCAT('%%%') . Can I get around this in anyway without filtering out the '%' ? 回答1: I'm assuming you mean you want to escape the % so it matches a literal % instead of anything. In that case, you just need: ... su.username LIKE CONCAT('%',REPLACE(email,'%','\\%'),'%') 回答2: You need to escape the %, so it literally matches '%'