FAQ Database Discussion Community


filter table mysql using multiple colums also between

php,mysql,filtering,between,sql-like
how to join BETWEEN statement and AND statement using multiple category? SELECT * FROM quick_inquiry WHERE inquiry_time BETWEEN '$start' AND '$end' AND inquiry_language LIKE '%$language%' AND service_country LIKE '%$country%' AND category LIKE '%$category%' AND replied LIKE '%$replied%' ...

MySql single column index or multi-column index in this case

mysql,indexing,sql-like
I have the following simplified table 'places', which contains 200,000+ rows: placeId INT(10) placeName VARCHAR (30) placeNameEnglish VARCHAR (30) placeName is a place name stored in the original language e.g. Rhône placeNameEnglish is a place name translated into english e.g. Rhone Currently I have two single column indexes - one...

Innacurate query with LIKE statement

mysql,mariadb,sql-like
Language is PHP, Database ORM is RedBean if(isset($get['last']) || isset($get['first'])){ $query = ''; $search_params = []; if(isset($get['first']) && !isset($get['last'])){ //search only with first name $query .= ' AND name LIKE :first '; $search_params[':first'] = '%'.$get['first'].'%'; $args['first'] = $get['first']; } else if(!isset($get['first']) && isset($get['last'])){ //search only with last name $query .=...

how to use like clause for a value saperated with comma in oracle

sql,oracle10g,sql-like
In my Database I have a column where the value is separated by a comma (firstname,lastname). I am trying to search this entire field in where clause using like condition. I have tired this. SELECT fullname from users where ( upper( fullname ) like upper('abc, xyz')) ...

Searching for any word or part of it inside string

postgresql,search,sql-like
I have been trying to implement search query, part of which is searching for a string. What I want to accomplish is search for any word(s) from an example string of "lorem ipsum dolor es" To claryfiy, I would like to find records which have lorem OR lorem ipsum OR...

MySQL JOIN two tables using LIKE and substrings

mysql,join,sql-like
I have been trying to join two MYSQL tables with columns that contain a common substring. My first table trim_table is a data set of substrings and its id. Each row contains an id, and a substring such as "1717 WINTON DR". The second table wp_prop contains a columnfield_313 that...

Use variable in sqlalchemy ilike statement

python,sqlalchemy,sql-like
I am trying to query my database to find all items that match my variable received_input. At the moment I have: session.query(VenueItem).filter(VenueItem.venue_item_name.ilike("%received_input%")).all() The items in my database may contain uppercase and lowercase characters. I need to ensure that the search is case-insensitive ("ApPle" would return from input of "apple"). I...

SQL find same value on multiple filelds with like operator

mysql,sql,search,like,sql-like
I have this records from my users table: user_id first_name last_name gender email ******* ********** ********* ****** ***** 229 Natalie Fern F [email protected] and I want to search same First Name & Last Name from first_name OR last_name. I have created sql query but not getting record. SELECT * FROM...

how to do a like query using mgo package for golang

mongodb,go,sql-like,mgo
I am trying to do a like query using mgo with no luck. what I want is a mongodb query similar to db.organisation.find( { "permalink" : /org.*/ } ) I am still stuck at sess.DB(db).C(cApp). Find(bson.M{"permalink": "org:bms.*"}). All(&m) ...

Query in Access using NOT LIKE

sql,ms-access,sql-like
I am using a query as follows. SELECT * FROM TableName WHERE ([Material Description] Not Like "*LICENSE*" Or [Material Description] Not Like "*LICENCE*"); However, this fetches me results having records with LICENCE or LICENSE in the Material Description field. Please advise as to what is that I am missing so...

Using CASE and LIKE to evaluate - logic issues

sql-like,case-statement,proc-sql
Unfortunately I am not a coder…I have used CASE statements before but not in combination with "LIKE". I'm not sure if my issues have to do with CASE or something else. I am using proc sql (SAS) to identify cases that have purchased specific products as defined by the COMPANY...

When do we use the _ (underscore) for sql select query?

mysql,sql,sql-like
I have come across one of the LIKE operators in sql which is the _ (underscore) I understand how it works as I have followed the tutorial from w3schools (http://www.w3schools.com/sql/sql_wildcards.asp) Question is, when is the suitable time to use it? - Regarding to web applications....

Trying to join Access tables with like statement with list in field

sql,ms-access,sql-like
I have a problem that I have been hunting for a solution to, but to avail. The basics are that I am trying to join 2 tables in Access by comparing a value in a field of Table 1 to a field in Table 2 that contains the number concatenated...

LIKE to select only the exact keyword

php,mysql,sql-like
Is it possible to SELECT LIKE the exact word in comma-separated column? tags: php,web,webdevelopment,java,javascript 'SELECT * FROM table WHERE tags LIKE "%java%"' This will select "java" and "javascript" Is it possible to select ONLY "java"? Thanks....

SQL and LIKE with alias

mysql,sql,sql-like
I'm trying to use alias in a LIKE but this doesn't work. I heard alias arent allowed in the WHERE clause, so how can I make my SQL request work? SELECT i.tag as mytag FROM tags as t, images as i WHERE i.id = 15 AND i.tag LIKE "%;myid;%" What...

Cassandra and advanced queries: Spark, ElasticSearch, Sorl

elasticsearch,cassandra,apache-spark,sql-like,like-operator
Ok, so, I'm developing an app and I'm using Cassandra as the database. Everything going good so far, but now I need to do a query using the LIKE clause. I know Cassandra doesn't support that, and that's why after looking for a workaround I was thinking in maintaining this...

Get records with blank field value using LIKE statement

sql,sql-like,like-operator
I am using a filter criteria to pull records where my table shows dynamic search results based on the input text. below is the code I am using - Me.Bookbindingsource.Filter = *Book_Author LIKE '*" & TextBox.Text & "*'" This field can be blank. When form loads, I want it to...

How to check exact integer value in string mysql

mysql,regex,sql-like
I have stuck on a problem where my column OFFER_DESCRIPTION contains String with Amount(Integer)....for example BUY ABOVE 200 BUY ABOVE 900 BUY ABOVE 300... A user can query something like this...offer for 200...then i am running a query something like this.... select * from offertable where OFFER_DESCRIPTION like '%200%'; OR...

MySql like with %

php,mysql,sql-like
I am trying to execute a SQL query that will give me all usernames from my table which begin with 'Ana%'. There are two rows like it: Ana Anastacia My code is like: $value="Ana" $sql=mysql_query("Select username from users where username like {"."'".$value."%"."'}"); $row=mysql_fetch_array($sql); print_r($row); The problem is I get information...

Cant use LIKE to extract data from mysql using php

php,mysql,sql-like
I have been battling with this code for some time and could do with some advice. I have created a mysql database of computer games and a simple search box and button within a form. If I type in any key word regarding the name of the game or its...

MySQL check if row with category exists

mysql,sql,sql-like,where-in
I'm using the Haversine formula with this query and it works until. The goal is to check if each row has certain categories in an value of $deflin which looks like $deflin = category1, category2, category3. The results will show rows within 50km and if it contains any of the...

sqlite3 compound index usage for LIKE and GROUP BY

sql,sqlite3,group-by,sql-like
I can't seem to get sqlite3 to not use a TEMP B-TREE with a compound index for a query with a LIKE clause and a GROUP BY clause. Seems to only use the index for the WHERE clause. I've tried making the index with all combinations with COLLATE NOCASE in...

LIKE operator in SQL for my Access Database returns no values in ASP CLASSIC while it does if the query gets copied directly in Access

sql,ms-access,asp-classic,sql-like
So as the title says, I'm trying to run a query in my ASP Classic page but for some reason it doesn't return a record set while it does returns a record set it if the query is copied directly in Access. There is one thing where it probably goes...

Does SQL LIKE iterate every row of table

mysql,sql,search,sql-like
I am just curious that if i have billions of rows in my SQL database's table in which one field is Username and i have to search names starting from letter G and data in db is unsorted so is LIKE statment iterate every row?? And if i sort data...

MySQL using OR with MATCH AGAINST slows query drastically

mysql,performance,full-text-search,sql-like,full-text-indexing
Columns are indexed and fulltext. Why does the "OR" add 5-8 seconds? SELECT * FROM exampleTable WHERE MATCH(someColumn) AGAINST('+testing123*' IN BOOLEAN MODE) // returns in .05 seconds SELECT * FROM exampleTable WHERE someColumn LIKE 'testing123%' // returns in .003 seconds SELECT * FROM exampleTable WHERE (MATCH(someColumn) AGAINST('+testing123*' IN BOOLEAN MODE)...

VBA Like Operator

vba,pattern-matching,outlook-vba,sql-like
I want to monitor our public e-mail folder for specific new mails to arrive and then use MsgBox to create a pop-up Window. Everything is set up and works prett well apart from the matching part using the Like Operator. I want to match the following string in the subject...

ruby like query error

mysql,ruby-on-rails,ruby,sql-like
This is my code for mysql like query: def search params.permit! @query = params[:query] respond_to do |format| @outlet = Outlet.select(:name).where("name like ?","[email protected]}%") format.json { render json: @outlet } end end It renders all of my data from table. It does not respond to the query. Do you have any ideas?...

Efficient MySQL text search

php,mysql,search,sql-like
I have a forum written in PHP using MySQL, and I'd like to make forum search available. It will allow users to search for particular strings, as well as filter on metadata like post date and subject and so on. The metadata can be efficiently searched because most of these...

Select ___where __LIKE ___

mysql,sql,database,select,sql-like
I want to select all the tables which don't contain the character _ from a database, for this I used the request : SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema="DB_NAME" AND TABLE_NAME NOT LIKE '%_%'; But it doesn't seem to work....

MySQL Like query not recognising anything but first word in database

php,mysql,string,sql-like
Basically I am trying to use a $gen variable to match a user query to a string stored in a database describing a genre of music. My problem is that if the genre is Indie/Pop and the user selects Indie as a search query the event will display. If they...

Looking to find a number embedded in a string at some random place - MS SQL Server 2008 R2

sql,sql-server,sql-like
I'm converting an old access database to a SQL solution. There is a comment field that the users used for a six digit number (sometimes). It is a free-form field and contains things like "ID# 123456", "123456", "ID #123456". In many cases, however, it just contains random notes that contain...