The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] SQL question


  • To: ukha_d@xxxxxxx
  • Subject: Re: [OT] SQL question
  • From: "Mark Pollock" <pollocmc@xxxxxxx>
  • Date: Wed, 11 Jul 2001 10:33:46 -0000
  • Delivered-to: rich@xxxxxxx
  • Delivered-to: mailing list ukha_d@xxxxxxx
  • Mailing-list: list ukha_d@xxxxxxx; contact ukha_d-owner@xxxxxxx
  • Reply-to: ukha_d@xxxxxxx

I actually get to answer something on this group, Hooray!

SELECT [Table A].[Company Name], First([Table B].EmployeeName) AS
FirstOfEmployeeName
FROM [Table A] INNER JOIN [Table B] ON [Table A].ID = [Table
B].[Company ID]
GROUP BY [Table A].[Company Name];

Mark

--- In ukha_d@y..., "James Hoye" <james.hoye@s...> wrote:
> Sorry for asking something completely non-HA, but I know you're such
a
> knowledgeable bunch...
>
> I have 2 tables, A and B where A has a one-many relationship with B
>
> How can I select from table A and only return the FIRST joined
record from
> B.
>
> Table A:
> ID	CompanyName
> =================
> 1	Acme Corp
> 2	Microshag
>
> Table B:
> CompanyID	EmployeeName
> ========================
> 1		Bloggs
> 1		Jones
> 1		Smith
> 2		Gates
> 2		Williams
>
> I need the SQL statement (if one exists) that will produce:
>
> CompanyName	EmployeeName
> ========================
> Acme Corp	Bloggs
> Microshag	Gates
>
> I'll be using Access2000/JET4
>
> Sorry for all those non-SQL bods...
>
> James H




____________________________________
Automated Home UK
http://www.automatedhome.co.uk
____________________________________

Your use of Yahoo! Groups is subject t  http://docs.yahoo.com/info/terms/




Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.