sql-like

Comma Seperated Values and LIKE php/mysql Troubles

巧了我就是萌 提交于 2019-12-25 03:35:01
问题 The Set up This is more or less a follow up question to something I had previously posted regarding comma separated values (explode,implode). Here's the scenario which has been stomping me the last few days as I'm a noob--sorry for the lengthy post. I'm passing a variable via the url (index.php?id=variable), I then check the database to find the rows containing that variable using SELECT * FROM table WHERE column LIKE '%$variable%' I'm using the wildcards because the results are a comma

Linq.Where-to-SQL on a text field comparing to a list of values

家住魔仙堡 提交于 2019-12-25 02:57:33
问题 Customer.text is a field in an T-SQL DB (that I do not control and thus may not alter) of type "text". I'd like to do something like this: List<string> compare = new List<string>(); compare.Add("one"); compare.Add("two"); var q = from t in customer where t.text.Contains( compare.First()) select t; this will work. But now I'd like to do something like: (!NOT WORKING!) var q = from t in customer where compare.Contains( t.text ) select t; How can I achieve this? Is it even possible? EDIT: The

JPQL like expression requires int value

孤街浪徒 提交于 2019-12-25 02:21:24
问题 I'd like to search a requested value in my database using the entity manager createquery function. Whenever I executed my method, I got the following error message: llegalArgumentException: You have attempted to set a value of type class java.lang.String for parameter searchvalue with expected type of int from query string It says that a int value is required, but I think that every like expression requires a string value? Entity: public class Contract implements Serializable { private static

Peta POCO like query issue

妖精的绣舞 提交于 2019-12-25 00:15:52
问题 I am using Micro ORM PetaPOCO, and I want to use like query, i am getting exception, please help me if any one know. var context = new PetaPoco.Database(Connection.connectionstring); SqlQuery = @"SELECT CmsPage.PageId, CmsPage.PageTitle, CmsPage.MenuId, CmsPage.PageDescription, CmsPage.Title, CmsPage.MetaKeyword, CmsPage.MetaDescription, CmsPage.CreatedDate, CmsPage.IsActive FROM ( SELECT ROW_NUMBER() OVER (ORDER BY CmsPage.PageTitle) AS row, CmsPage.PageId, CmsPage.PageTitle, CmsPage.MenuId,

Searching through ListView item and database on Android

。_饼干妹妹 提交于 2019-12-24 19:24:21
问题 I tried this code but it's too time-taking to iterate through all the list item. item_all is a list which contains data I got from the database. et_Search.addTextChangedListener(new TextWatcher() { int textlength; long time = System.currentTimeMillis(); @Override public void onTextChanged(CharSequence s, int start, int before, int count) { textlength = getSearchText().length(); item_filtered = new ArrayList<StockItem>(); long time = System.currentTimeMillis(); int i = 0; do { int startpost =

Is there any way to replace like condition in postgresql?

六月ゝ 毕业季﹏ 提交于 2019-12-24 15:05:03
问题 I am having the following query in my code. It takes a minute to get the data due to to the like condition. If you have any way to replace it or speed up the retrieve time, Please let me know. select id, url from activitylog where resource = 'jobs' and (method = 'saveTechStatus') and (url like '%/jobs/saveTechStatus/81924/%') order by timestamp desc; 回答1: You could use a trigram index: CREATE EXTENSION pg_trgm; CREATE INDEX ON activitylog USING gin (url gin_trgm_ops); This may take a lot of

How to use like clause in MySQL 5.0 Statement

一曲冷凌霜 提交于 2019-12-24 14:13:57
问题 I have a problem using 'like' clause in MySQL 5.0 I have written a stored procedure in MySQL 5.0 and calling the Stored Procedure from my Java Program the stored procedure below in the select statement i want to take the value of parameter departmentname for like clause please Help with this DROP PROCEDURE IF EXISTS upSelTests; DELIMITER // CREATE PROCEDURE upSelTests ( IN departmentname varchar(50), IN testDateFrom varchar(10), IN testDateTo varchar(10) ) BEGIN declare testDateFrom1 varchar

mysql SELECT WHERE string contains characters

懵懂的女人 提交于 2019-12-24 14:01:20
问题 I have a table field events which can contains: Only a sequence of number, for example: 45 or a sequence of number divided by the symbol | , for example 55|65|76 I think i have to use LIKE , but i don't know how. Can you help me? Thanks 回答1: I would recommend using CONCAT to add a pipe | before and after your field, and then using a LIKE search. Something like this: SELECT * FROM YourTable WHERE concat('|',field,'|') like '%|45|%' SQL FIddle Demo However, I highly recommend trying to

In PostgreSQL how to combine NOT IN and LIKE?

白昼怎懂夜的黑 提交于 2019-12-24 09:36:38
问题 How do you combine NOT IN and LIKE ? Let's assume we have a table that contains a column of names (something like 'blue cheese', 'gouda cheese' and so on) and I want to select all the names that doesn't contain 'cheese', 'milk', 'meat'. As far as I understand to look for something that is not in an array of strings you use NOT IN and the pass the strings SELECT names FROM some_table NOT IN('cheese','milk','meat'); but how do I pass LIKE '%cheese%' to it? 回答1: The construct LIKE ANY (ARRAY[...

how to use glob with sqlite in android

雨燕双飞 提交于 2019-12-24 08:39:09
问题 I have a database of 23,000 words. I want to have the query return all words that start with a certain search string. After reading sqlite LIKE problem in android I was able to get a working query using LIKE. Here it is: SQLiteDatabase db = getReadableDatabase(); SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); String [] sqlSelect = { KEY_WORD }; String sqlTables = TABLE_WORDS; //String selection = KEY_FUZZYWORD + " =?"; // for an exact match String selection = KEY_FUZZYWORD + " LIKE ?";