How to use JOINS

2001-09-12 Thread Deryck Henson

OK, well, mysql has LEFT JOINS, right?  OK then, in that case, how the heck
do I use them?!  I need to join 14 tables (with the exact same structure,
columns) together and view all of there contents with a WHERE clause like
this:

SELECT * FROM t1, t2, t3, t4, t5, etc ORDER BY date DESC

or

SELECT * FROM theworks WHERE userid = 'userid'

Any suggestions?  I need that join.  WHY?  Because it's ambiguous if I dont
have it.

- Deryck H
- http://www.comp-u-exchange.com


-
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




Re: How to use JOINS

2001-09-12 Thread Jeremy Zawodny

On Wed, Sep 12, 2001 at 02:13:59AM -0500, Deryck Henson wrote:

 OK, well, mysql has LEFT JOINS, right?  OK then, in that case, how
 the heck do I use them?!  I need to join 14 tables (with the exact
 same structure, columns) together and view all of there contents
 with a WHERE clause like this:
 
 SELECT * FROM t1, t2, t3, t4, t5, etc ORDER BY date DESC
 
 or
 
 SELECT * FROM theworks WHERE userid = 'userid'
 
 Any suggestions?  I need that join.  WHY?  Because it's ambiguous if
 I dont have it.

I'm not entirely sure, but it sounds like you might be confusing a
JOIN with a UNION.

JOINs are used to bring together related records (related in the
RDBMS sense of related) into larger records composed of columns from
each table.

A UNION allows you to treat several similarly structured tables as if
the are one large table.  MySQL doesn't yet have UNIONs (4.0 will),
but it does have MERGE tables which allow you to combine several
tables into a sort of virtual table against which you can write
queries.

Hope this helps,

Jeremy
-- 
Jeremy D. Zawodny, [EMAIL PROTECTED]
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.41-max: up 6 days, processed 131,748,231 queries (248/sec. avg)

-
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




Re: How to use JOINS

2001-09-12 Thread Deryck Henson

Merges wont work because they dont allow inserts.  But I'll check out UNION.
Thanx

- Deryck H
- http://www.comp-u-exchange.com
- Original Message -
From: Jeremy Zawodny [EMAIL PROTECTED]
To: Deryck Henson [EMAIL PROTECTED]
Cc: MySQL [EMAIL PROTECTED]
Sent: Wednesday, September 12, 2001 2:56 AM
Subject: Re: How to use JOINS


 On Wed, Sep 12, 2001 at 02:13:59AM -0500, Deryck Henson wrote:
 
  OK, well, mysql has LEFT JOINS, right?  OK then, in that case, how
  the heck do I use them?!  I need to join 14 tables (with the exact
  same structure, columns) together and view all of there contents
  with a WHERE clause like this:
 
  SELECT * FROM t1, t2, t3, t4, t5, etc ORDER BY date DESC
 
  or
 
  SELECT * FROM theworks WHERE userid = 'userid'
 
  Any suggestions?  I need that join.  WHY?  Because it's ambiguous if
  I dont have it.

 I'm not entirely sure, but it sounds like you might be confusing a
 JOIN with a UNION.

 JOINs are used to bring together related records (related in the
 RDBMS sense of related) into larger records composed of columns from
 each table.

 A UNION allows you to treat several similarly structured tables as if
 the are one large table.  MySQL doesn't yet have UNIONs (4.0 will),
 but it does have MERGE tables which allow you to combine several
 tables into a sort of virtual table against which you can write
 queries.

 Hope this helps,

 Jeremy
 --
 Jeremy D. Zawodny, [EMAIL PROTECTED]
 Technical Yahoo - Yahoo Finance
 Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

 MySQL 3.23.41-max: up 6 days, processed 131,748,231 queries (248/sec. avg)

 -
 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


-
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