Is it possible in SQL to do grouping by LIKE patterns? I would like to achieve something like this:
id|name
1 | Mike
2 | Bob
3 | Bill
4 | Alice
and then doing query like: SELECT name from users group by _pattern_
For example I would like to get groups by matching patterns 'B*', '*l*' and 'Mike'
would give the output:
B* ...
I have a table in my database that includes some columns that are used for LIKE expressions in SQL. The process I'm working with uses those expressions to exclude certain SQL objects from processing.
I'm now putting similar code in Powershell, but I'd like to keep the columns consistent. I'm going to need to do something along the lines...
I have been told that searching in a MySQL database with LIKE '%wordend' is bad because it takes very long time.
What is the best way of searching on the end of a field?
Should I make an extra field where field that needs to be searched backwards is stored backwards, seems like an ok idea to me since it will give the benefit of indexin...
We have a list of strings and we need to filter our results by that list. Example would be find all students who have SSNs that start with 465, 496, or 497 (plus x more)
List<string> list = GetPossibleStartsWithValues();
var qry = from student in entities.Students.WhereStartsWith(x=>x.SSN, list)
select new SearchedStudent
{
Name ...
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(...
In terms of performance, how does the like operator behaves when applied to strings with multiple % placeholders?
for example:
select A from table_A where A like 'A%'
takes the same time to select than
select A from table_A where A like 'A%%'
???
...
I've got 2 tables: one stores tags, the other stores articles. There's a mode "Get articles by tag", which basically takes all articles, tagged "x". In my articles table I use a filed, called Tags, that stores data in such pattern 'tag1, tag2, tag3, ...'.
So I want to get everything work by just a single query like that:
SELECT *,
...
I am relatively new to LINQ and don't know how to do a Like condition. I have an IEnumerable list of myObject and want to do something like myObject.Description like 'Help%'. How can I accomplish this? Thanks
...
Hi every one,
I have the following SQL query:
SELECT C.ID, C.Name FROM Category C JOIN Layout L ON C.ID = L.CategoryID
JOIN Position P ON L.PositionID LIKE '%' + CAST(P.ID AS VARCHAR) + '%'
WHERE P.Code = 'TopMenu'
and following data
Position:
ID Code
1 TopMenu
2 BottomMenu
Category
ID Name
1 Home
2...
Let's say I have table [users] with the field [Name] and I've written a query in my application to search by name.
The names in the database are:
Lala
Ally
My SQL query is:
SELECT * FROM users WHERE [Name] LIKE '%al%'
where 'al' is my search term.
How would I sort the results by search term found in the beginning i.e. '%al' and o...
Hi,
I am trying to create a good little search statement that searches muitple fields using the with different search terms depending on what is returned. I am basiclly setting an order in which I want to search if one search term is not found try the next one. However I am using a WHERE clause to seperate search only one type of data....
i would like to search in DB
input string is "oxoşil"
o -> [o-ö]
x -> [x-ks]
ş -> [s-ş]
ş -> [ş-sh]
i need to search all of these cominations.
Needed finally search criteria is [o-ö][x-ks][o-ö][ş-s-sh][i-ı]l
is there any way to to this with t-sql like operator? or in linq?
...
Hello guys,
I have a table contains 413,000 places name (Pris, London,...) is there a way (query) to select locations from specified text.
for example:
" Transport for London (TfL) is in talks with its American, Australian and European partners about issuing a single contactless card for Paris, New York".
I want a query to get:
* Lo...
Is there some kind of SQL Statement that I can used to do a search on 1 Column in my table that is similar to what I am looking for.
Like if I am looking for something to do with a "Car" but I spell it as "Kar" it must return items of "car".
Or
If I am looking for "My Company" and I spell it as "MyCompany" it must still retun "My Com...
Hi!
I want to do a 'select' in MySQL using the operator 'LIKE'.
But I do not want to use text as a comparison factor. I want to compare text between two fields in same table, like this:
SELECT field1,field2 FROM table WHERE field2 LIKE %field1% ;
Is it possible?
...
I need some mysql code that uses a select output in LIKE statement in WHERE.
I mean something like this:
SELECT id FROM (SELECT id,parent_id FROM units WHERE ptitle
like '%(SELECT ptitle FROM units WHERE id='".$id."')%')
Thanks for your help.
...
I'm creating result paging based on first letter of certain nvarchar column and not the usual one, that usually pages on number of results.
And I'm not faced with a challenge whether to filter results using LIKE operator or equality (=) operator.
select *
from table
where name like @firstletter + '%'
vs.
select *
from table
where le...