sql-like

Objective-C sqlite adding query parameter inside of LIKE clause

假如想象 提交于 2019-12-23 10:06:38
问题 I am using sqlite in Objective-C via the C API. One of the intended features of my app is that the user can search for a person name and with each new character they enter, an SQL query using LIKE is executed to find all people whose names qualify as a match. The issue I am running into is parameterizing the match inside the LIKE, without the question mark being interpreted literally. That is, I believe the app at present is looking for people's names that include ? in them (which is nobody).

Objective-C sqlite adding query parameter inside of LIKE clause

久未见 提交于 2019-12-23 10:05:52
问题 I am using sqlite in Objective-C via the C API. One of the intended features of my app is that the user can search for a person name and with each new character they enter, an SQL query using LIKE is executed to find all people whose names qualify as a match. The issue I am running into is parameterizing the match inside the LIKE, without the question mark being interpreted literally. That is, I believe the app at present is looking for people's names that include ? in them (which is nobody).

“LIKE” operator works in MS Access, but not ADO

半城伤御伤魂 提交于 2019-12-23 09:34:22
问题 I'm trying to filter records using "Like" with asterisks, it works when using Access 2010 returning many records. I'm stumped why it returns nothing when used with ADO. The code includes multiple tables and columns so to troubleshoot I made a simple query. Here's the code: strsql = "SELECT tproducts.Prod_Name FROM tproducts " _ & " WHERE tproducts.Prod_Name Like " & Chr(34) & "SO*" & Chr(34) Set cn = New ADODB.Connection cn = connString cn.Open Set rs = New ADODB.Recordset rs.Open strsql, cn,

LIKE work-around in SQL (Performance issues)

我只是一个虾纸丫 提交于 2019-12-23 09:17:46
问题 I've been reading around and found that using LIKE causes a big slowdown in queries. A workmate recommended we use Select Name From mytable a.Name IN (SELECT Name FROM mytable WHERE Name LIKE '%' + ISNULL(@Name, N'') + '%' GROUP BY Name) in lieu of Select Name From mytable a.Name LIKE '%' + ISNULL(@Name, N'') + '%' Now I'm no SQL expert and I don't really understand the inner workings of these statements. Is this a better option worth the effort of typing a few extra characters with each like

Mysql - how to use like on multiple columns

久未见 提交于 2019-12-23 02:42:23
问题 I've searched in mysql query a word in multiple column in java program. The number of column is variable. It is correct this query: select * from customer with (city, name) like%'adelaide'% 回答1: You can use CONCAT() function: select * from customer WHERE concat(city,name) like '%adelaide%' You can add as many columns to the concat function as you like. Also as you see I changed your like syntax, '%WORD%' and used a simple where clause. 回答2: It's better to use CONCAT_WS() function. CONCAT()

PHP/mySQL - using result from 'CONCAT' and 'AS' in 'LIKE' clause

喜夏-厌秋 提交于 2019-12-23 02:31:18
问题 Hi I have the following code; if( ! empty( $post['search-bar'] ) ) { $search_data = preg_replace("#\s\s#is", '', preg_replace("#[^\w\d\s+]#is", '', $post['search-bar'] ) ); $data_array = explode( " ", $search_data ); $data_array = "'%" . implode( "%' OR '%", $data_array ) . "%'"; $query = " SELECT CONCAT( PROFILE_PROFFESION, FIRST_NAME, LAST_NAME, DISPLAY_NAME) AS 'STRING' FROM `" . ACCOUNT_TABLE . "` WHERE STRING LIKE ( " . $data_array . " ) AND BUSINESS_POST_CODE LIKE '" . substr(P_BUSINESS

Using LIKE to match floats when Rounding is not wanted

ぃ、小莉子 提交于 2019-12-22 18:45:25
问题 So here is what I am trying to accomplish. I have coordinate data in two tables, which I am trying to link together with an Association table. It is a one to one association, so if I have 40 records in table A, 40 records in table B, then I should have 40 records in the association table. Now the data in these two tables is approximately the same, but never idential, in fact they rarely even have the same precision. One table(we'll say A) always has 6 decimal places, whereas table B may have

CREATE TABLE new_table_name LIKE old_table_name with old_table_name's AUTO_INCREMENT values

試著忘記壹切 提交于 2019-12-22 17:42:31
问题 Can I create a new table with an old table's autoincriment status in mysql client? I think, that ALTER TABLE new_table_name AUTO_INCREMENT=@my_autoincr_iment helps me, but this construction must use with a constant value. I don't want to use a difficult script. 回答1: mysql> create table new_table like old_table; mysql> select @my_auto_increment:=auto_increment from information_schema.tables where table_name='old_table'; mysql> set @query = CONCAT("alter table new_table auto_increment = ", @my

mysql search for a catid in a text field

我的未来我决定 提交于 2019-12-22 13:54:19
问题 I'm trying to do a mysql search (in php) for a catid number within a text field. I'm currently using LIKE but I need it more specific. Here's my code: SELECT * FROM articlepix WHERE published = 1 AND catid LIKE '%86%' ORDER BY RAND() LIMIT 1 ^^ I'm looking for the number 86 within the catid field, but I want it to look for only 86, currently it's pulling out the data with the number 186 too. The above example grabs the field where the catid is "91,107,36,139,146,168,186". Is it possible to

SQL-Server is ignoring my COLLATION when I'm using LIKE operator

耗尽温柔 提交于 2019-12-22 08:46:11
问题 I'm working with Spanish database so when I'm looking for and "aeiou" I can also get "áéíóú" or "AEIOU" or "ÁÉÍÓÚ", in a where clause like this: SELECT * FROM myTable WHERE stringData like '%perez%' I'm expencting: * perez * PEREZ * Pérez * PÉREZ So I changed my database to collation: Modern_Spanish_CI_AI And I get only: * perez * PEREZ But if I do: SELECT * FROM myTable WHERE stringData like '%perez%' COLLATE Modern_Spanish_CI_AI I get all results OK, so my question is, why if my database is