how to join the below queries into a single query

Hi Experts,

how do i join the below query
can any one suggest me

SELECT id,domain_id FROM `master` `t` WHERE domain_id!=0 AND customer_id=7 AND status=1 GROUP BY domain_id
42 i am placing in secondquery
357 i am placing in thirdquery

SELECT FROM `master` `t` WHERE t.customer_id=7 AND status=1 AND t.domain_id=42 AND date(runtime) BETWEEN ("2014-06-01") AND ("2014-06-30")

SELECT t.task_id FROM `task` `t` WHERE =357 ORDER BY id desc LIMIT 1

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kanti PrasadCommented:

I am not sure about your table structure but try this

SELECT m.domain_id FROM master m  WHERE m.customer_id=7, m.domain_id IN( 357, 42 , !0) AND m.status=1  AND BETWEEN ("2014-06-01") AND ("2014-06-30") GROUP BY t.domain_id ORDER BY  t.domain_id
ON m.domain_id=t.task_id;
srikoteshAuthor Commented:
i will get the input of customer id and status first
based on customer id and status i am exectutiin first query
then i am getting the result as
domain id-42 and id as 357

i have to write a subquery first to get the result from first query then that value i have to add in second query and third

relation ship b/w table is
Kanti PrasadCommented:

Can you please give me the output you are expecting and if possible the table names and the column values you have so that I can understand your query request better?
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

srikoteshAuthor Commented:
i have written the query

SELECT t.task_id FROM task as t inner join master as dm on where t.customer_id=7 AND status=1 AND  date(runtime) BETWEEN ("2014-06-01") AND ("2014-06-30") and t.domain_id in (SELECT domain_id FROM `master` `t` WHERE domain_id!=0 AND customer_id=7 AND status=1 GROUP BY domain_id) ORDER BY id desc LIMIT 1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kanti PrasadCommented:

So I assume you are fine then ...
srikoteshAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.