SELECT sd.month, sd.day, names.who, names.uid, sd.type
FROM specialdays as sd

INNER JOIN names
ON names.uid = specialdays.uid

WHERE sd.month=6 AND sd.day=5


Give that a whirl to start with. I've assumed the field on the specialdays
table that links to the names table is also called uid. Or are you linking
on their name? Hope not!


HTH,
Nick


:> -----Original Message-----
:> <newbie warning>
:> I'm trying to write my first shell script using MySQL.  I've checked
:> Welling & Thomson and Google but I think I'm searching the wrong
:> keywords or something.
:>
:> The shell script will be non-interactive, but interactively this is what
:> I would do:
:>
:> mysql> select * from specialdays where month="6" and day=5;
:>
:> +-------+-----+-------------+-----+------------+
:> | month | day | who         | uid | type       |
:> +-------+-----+-------------+-----+------------+
:> |     6 |   5 | Homer Burns | 8   | Birthday   |
:> +-------+-----+-------------+-----+------------+
:>
:> Then I take the UID and search the 'names' table to get the
:> corresponding email address
:>
:>
:> mysql> select email from names where uid=8;
:> +--------------------------+
:> | email                    |
:> +--------------------------+
:> | [EMAIL PROTECTED]     |
:> +--------------------------+
:>
:>
:> Now what I would really like to get is something that looks like this:
:>
:> 6/5 Homer Burns [EMAIL PROTECTED] Birthday
:>
:> I'd appreciate any tips on how to proceed.... I'm stumped.
:>
:> TjL
:>
:>
:>
:> ---------------------------------------------------------------------
:> 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

Reply via email to