I have 2 different columns in the same table, and I want to select lines which contain the word “Hello”. For the first column, I’m using this SQL statement: SELECT * FROM table1 WHERE column1 LIKE …
Tag: sql-like
SQL – Like and wildcard, not expected result
I’m still a newbie with SQL so please be patient with me. I have got the following WHERE statement in a query: It’s producing the following result (as expected): While if I remove the ending wildcard, like this: It results in an empty table. What I cannot understand is that the city name “Re…
Use Like operator in Select query with results from another Select query
I have a query with inner joins that returns 4-5 rows – the query: select Table1.valstring Prefix from TestDB.dbo.SomeCompany PC INNER JOIN TestDB.dbo.CMCompany CMC ON PC.companyuid = CMC….
Multiple LIKE Operator ORDER BY Strongest
I have the following query: SELECT * FROM table_name WHERE (genre LIKE ‘%romance%’ OR genre LIKE ‘%comedy%’ OR genre LIKE ‘%horror%’) ORDER BY *the column that has more* OR SOMETHING LIKE …
MySQL – JOIN with table on partial string match
Trying to LEFT JOIN a table with partial string match. I’ve tried changing the wildcard in the LIKE condition, but it still only searches for the full string. Any suggestions? I’ve got a list of product abbreviations stored in a table. Would be easier to manage this list with partial matching vers…
Comparing Substring Against Multiple Columns
I have a table which has 20 similar text attribute columns, text1..text20. These columns are of type CLOB. I am looking to find rows where one of these text attribute columns contain a specific phrase, such as ‘%unemployed%’. I need to know 2 things, which rows match, and which column was matched …
How to search for multiple words with one query?
I am trying to make a simple php search using the following query. This works perfectly however the query only gives results for the first word. Would there be a way to get a combined result for all …
Using LIKE in SQL with multiple search terms
I’m doing a basic SQL course and learning the basics currently and having issue with filtering: Task: list all the rows from TableName where the columnName field content does not contain any of the following words: ‘stack’ or ‘overflow’ or ‘exampleword’. -> I get i…
Hive – find 2 characters anywhere in the string/row – RLIKE
How do I get the data for ONLY “_WA” data assigned to “USA_RBB_WA_BU”? However the column I look at has rows that contain _WA and _SA (USA_CA_SAWANT) I used, select…. …
Trouble understanding a LIKE operator syntax
I got pasted a source code to extract a particular dataset and I am having a problem understanding one of the bits. Here’s the part of a query: Could you help me translate what does the inside bracket of this LIKE operator mean? Many thanks in advance. Answer COALESCE takes second argument if first one …