[ale] any SQL gurus?

Matthew Brown matthew.brown at cordata.com
Wed Jan 21 10:36:31 EST 2004


SELECT COPY.copy_key, TITLE.title_key, TITLE.name FROM COPY INNER JOIN TITLE
on COPY.title_key = TITLE.title_key WHERE COPY.owner = [your-owner-value]


Matthew Brown
 	      (888) 681-2262     .     (770) 795-0089     .
http://www.cordata.com	 

	
*	Windows and Linux Networks
*	Anti-virus
*	Security
*	Email
*	Web Development & Hosting
	
*	Application Development & Hosting




-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of Jason
Etheridge
Sent: Wednesday, January 21, 2004 10:20 AM
To: Atlanta Linux Enthusiasts
Subject: [ale] any SQL gurus?

Hi guys, this has been driving me nuts and maybe you would enjoy figuring it
out. :)

I have two tables: TITLE and COPY.  There is a one-to-many relationship
between the two; for any given title, there could be many copies.  
Copies have owners, but titles don't belong to anyone.

	table TITLE:
		field title_key	PRIMARY KEY
		field name	CHAR
	table COPY:
		field copy_key	PRIMARY KEY
		field title_key	FOREIGN KEY
		field owner	CHAR

However, owners would like a list of what titles they happen to have copies
for.  I can do this through brute-force with a programming language, but is
there a single SQL query I could use?  Specifically, MySQL (I don't have
sub-selects)?

I'm sure this is simple and obvious and I'll feel like more of an idiot
later.  *8)

Thanks,
Jason

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list