On Thu, 22 Feb 2001, Oson, Chris M. wrote:
> Good Day All
>
> I have two tables...
>
> Table 1
> -------
> MSRSectionID ContractID Heading
> 1
> 1 107 Technical Progress:
> 7 107 Technical Problems:
> 13 107 Administrative Actions Pending:
> 19 107 Problems/Issues:
> 25 107 Completed Travel:
> 31 107 Expected Travel:
> 37 107 Plans For Next Reporting Period:
>
> Table 2
> -------
> MSRSectionID Description
>
> 1 Updates may be made here.
>
> Now what I want to do is grab all the Headings from the first table
> regardless of the number of entries in the second table. So the output of
> my desired query should look...
>
> Technical Progress:
> --> Updates may be made here.
> Technical Problems:
> Administrative Actions Pending:
> Problems/Issues:
> Completed Travel:
> Expected Travel:
> Plans For Next Reporting Period:
>
> The output for the description doesn't need to be indented. I was just
> trying to explain as well as I can what I'm trying to get.
>
> I tried using a outer joins on both tables, but I'm not getting what I want.
What you want is a left join (it is outer indeed as you guessed)
select if(t2.name is null,t1.name,concat(t1.name,t2.name)) from table1 as t1 left join
table2 as t2 on t1.sectionID=t2.sectionID;
regards,
thalis
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php