Unix Technical Forum

Combining Queries

This is a discussion on Combining Queries within the MySQL forums, part of the Database Server Software category; --> Hi, I have the following query called Q1 - SELECT TestVersion.TestId, TestVersion.VersionNo FROM (TestVersion LEFT JOIN Release ON TestVersion.ReleaseId ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
aine_canby@yahoo.com
 
Posts: n/a
Default Combining Queries

Hi,

I have the following query called Q1 -

SELECT TestVersion.TestId, TestVersion.VersionNo FROM (TestVersion
LEFT JOIN Release ON TestVersion.ReleaseId = Release.ReleaseId) LEFT
JOIN ReleasePlan ON Release.ReleaseId = ReleasePlan.ReleaseId WHERE
(((ReleasePlan.StartDate)<=CDate("2006-04-19"))) ORDER BY
TestVersion.TestId;

plus this query -

SELECT Max(Q1.VersionNo) AS MaxOfVersion, Q1.TestId FROM Q1 GROUP BY
Q1.TestId;

how can I combine these into one query.

Thanks for your help,

Aine

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:27 AM
Aaron Saray
 
Posts: n/a
Default Re: Combining Queries

On Sep 11, 4:12 am, aine_ca...@yahoo.com wrote:
> Hi,
>
> I have the following query called Q1 -
>
> SELECT TestVersion.TestId, TestVersion.VersionNo FROM (TestVersion
> LEFT JOIN Release ON TestVersion.ReleaseId = Release.ReleaseId) LEFT
> JOIN ReleasePlan ON Release.ReleaseId = ReleasePlan.ReleaseId WHERE
> (((ReleasePlan.StartDate)<=CDate("2006-04-19"))) ORDER BY
> TestVersion.TestId;
>
> plus this query -
>
> SELECT Max(Q1.VersionNo) AS MaxOfVersion, Q1.TestId FROM Q1 GROUP BY
> Q1.TestId;
>
> how can I combine these into one query.
>
> Thanks for your help,
>
> Aine


I believe you'd be able to put the selected columns in the beginning
of your select query, and then put a comma after your from's table,
and add in your second table.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:05 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com