Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql IN Subquery with additional value

Tags:

sql

mysql

I'm trying to select rows using IN but I want to add inside IN statement another value.

Example

SELECT title FROM film WHERE film_id IN (SELECT film_id FROM film_actor)

Ok... Get result..no problem..

SELECT title FROM film WHERE film_id IN ((SELECT film_id FROM film_actor), 130)

How can add another value (130) like the query above?

Tks. Adriano

like image 943
adrianogf Avatar asked Jun 29 '26 19:06

adrianogf


1 Answers

Try to use union allas below

SELECT title FROM film WHERE film_id IN (SELECT film_id FROM film_actor
                                         union all
                                         SELECT 130)
like image 110
Robert Avatar answered Jul 01 '26 09:07

Robert