Answer the question
In order to leave comments, you need to log in
Prompt with sql query
There is a query in the form of
SELECT value FROM table WHERE value2 in ('1','2','3','1')
how to make rows output according to the number of duplicates in case of duplicate values in the in operator argument?
Those.
if a table of type
value value2
1 1
2 2
3 3
would output
value
1
2
3
1
Answer the question
In order to leave comments, you need to log in
Because is the result of another query, then the solution is:
SELECT YOUR_TABLE.value
FROM ( SELECT value FROM… bla bla ) AS tbl < - here is your second query
LEFT JOIN YOUR_TABLE ON YOUR_TABLE.value2 = tbl.value
( SELECT value FROM… bla bla ) - there should be a query that returns the list you need in the value column
As far as I remember, using IN is not possible. It immediately comes to mind to make a temporary table from one column, insert all the values from IN there and then rewrite the query for what type
SELECT value
FROM table t
JOIN tmp_tabel t2 ON (t.value2 = t2.value)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question