Questions tagged [sql-match-all]
51 questions
1
vote
2 answers
Select a product from filters
I have a problem with a query:
I have 3 tables:
products (id, name)
settings (id, name)
product_setting (product_id, setting_id)
for example: I would like to select only the products you have selected filters!
I do this:
SELECT p. *, s.id as…

Mauro
- 1,447
- 1
- 26
- 46
1
vote
2 answers
Force mySQL to join a table(to do a unoptimized query, that i need)
This is kinda weird. I have the next query:
SELECT * , GROUP_CONCAT( x.tag
SEPARATOR ',' ) AS tags
FROM tag AS t, tag AS x, tag_message_rel AS r, message m
INNER JOIN `user` AS u ON m.user_id = u.id
WHERE t.tag
IN (
'kikikiki', 'dsa'
)
AND m.id =…

DFectuoso
- 4,877
- 13
- 39
- 55
1
vote
3 answers
Vanilla SQL that selects multiple values in single column
If I have a table with customer IDs in one column and time zones in another, is there a plain SQL statement that can select all customer IDs that have different time zone values? In other words, I want to find those customers with offices in New…

phileas fogg
- 1,905
- 7
- 28
- 43
1
vote
2 answers
How to do this query in Mysql?
I have 3 tables, message, subject and message_subject_rel. The idea is to have messages that can relate to a lot of subjects and then do a cross subject search.
Lets say I have a message:
Id: 1, Message: This is a message
2 subjects:
Id:1, Subject:…

DFectuoso
- 4,877
- 13
- 39
- 55
1
vote
2 answers
Query to match foreign key relationships
I have two tables in a this is Postgres database representing simple orders from a market. A master table with information about the order, and a detail table with containing specifics of the purchase, with a foreign key back to master. Easy…

G. Ball
- 379
- 1
- 3
- 9
1
vote
3 answers
Mysql select data using multiple conditions
I have a table like
id fid
20 53
23 53
53 53
Here I need to return true when my condition is something like .. where fid=53 and id in(20,23,53)
and also I need to return false when....where fid=53 and id in(20,24,53).
But the above…

Aadi
- 6,959
- 28
- 100
- 145
1
vote
2 answers
Get group key from bridge table
I'm developing an ETL process, and need a bridge table for a one-to-many relationship between a fact table and a dimension table (MySQL database). There is a limited number of combinations (some thousands), so I want to re-use group keys from the…

Mads Mogenshøj
- 2,063
- 1
- 16
- 23
1
vote
2 answers
Joined elements should *all* match some criteria
I have a setup like:
conversations(id)
notifications(id, conversation_id, user_id)
users(id)
If a conversation concerns someone, the user is linked to the conversation through one notification.
GOAL: I'm looking for conversations which concern…

apneadiving
- 114,565
- 26
- 219
- 213
1
vote
4 answers
SQL Select Condition Question
I have a quick question about a select statement condition.
I have the following table with the following items. What I need to get is the object id that matches both type id's.
TypeId ObjectId
1 10
2 10
1 11
So I need to get…

Josh
- 11
- 1
1
vote
2 answers
SQL, matching all the values in column b and return column a for those matches
I'm only looking at one table, I have the values I need to match, so.
Col A / Col B
1 / 1
1 / 2
1 / 3
2 / 2
2 / 3
4 / 1
4 / 3
So the values I pass in would be 1 and 3 and I'd want to return 1 and 4.
I've tried a group by with a could, where I've…

Jules
- 7,568
- 14
- 102
- 186
1
vote
2 answers
SQL to select half of a two-part composite key based on multiple rows of keys?
I have a table with a composite key like this:
========TABLE========
key_a_col | key_b_col
Scenario:
key_b is 'foo', and there is a 'bar' and 'baz' entry under key_a for it. Another key_b 'fiz' has 'bar' and 'raz'.
Like…

jeremiahs
- 3,985
- 8
- 25
- 30
0
votes
2 answers
How do I find groups of rows where all rows in each group have a specific column value
Sample data:
ID1 ID2 Num Type
---------------------
1 1 1 'A'
1 1 2 'A'
1 2 3 'A'
1 2 4 'A'
2 1 1 'A'
2 2 1 'B'
3 1 1 'A'
3 2 1 'A'
Desired result:
ID1 …

khaledh
- 1,047
- 1
- 10
- 17
0
votes
3 answers
is there a mysql clause for multiple and statements like IN?
is there an easy way to do multiple AND statments like the IN clause does for OR?

waa1990
- 2,365
- 9
- 27
- 33
0
votes
2 answers
SQL Server: How to check if values in a column match ALL the values from a subquery?
I have a table with a column containing values in a comma-separated list, like so:
| ObjectID (int) | Column1 (nvarchar(max))|
| 1 | 152, 154, 157, 158 |
| 2 | 101, 154, 155 |
| 3 | 97, 98, 99 …

BohdanZPM
- 695
- 2
- 10
- 22
0
votes
0 answers
Difference between like and match in boolean mode for unicode word myql query
I am querying for a unicode word in join. When I use LIKE in the where condition, it gives more number of results as compared to using MATCH in BOOLEAN MODE. But when I am trying to find the differences between the queries, it is giving null…

user20152015
- 344
- 2
- 23