Run multiple statements to get result
Hi there
I need to run a query that select some specific results from a table and in addition a number of additional selected results from the same table.
For example, I want to retrieve 20 results from a table of which 5 are already specified and the other 15 can be anything from the table.
I have used the following query but it doesn't work
Code:
Select(
select id,text from table
where id in ('1',
'2',
'3',
'4',
'5')
) as s_id,
(
select id,text
from table limit 15
) as m_tweets
Can someone tell me if there's a way to achive this and how.
Thank you
Re: Run multiple statements to get result
Ok found the solution
For anyone who wants to run multiple statemtn union all,union will do the job
The syntax is as follow:
Code:
SELECT * FROM table limit 10;
union
SELECT * FROM table limit 20;
Note: If you don't want to get duplicates use union instead of union all.
Re: Run multiple statements to get result
I think it could be.....
Quote:
select id,text from table where id in ('1','2','3','4','5')
union
select id,text from table limit 15