Tim Luoma wrote:
>
> <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
Try:
SELECT
concat(s.month,'/',s.day) AS "date",
s.who,
n.email,
s.type
FROM
names n
LEFT JOIN specialdays s USING (uid)
WHERE
month = 6
AND day = 5
;
>
> 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
>
--
Ralf Narozny
SPLENDID Internet GmbH & Co KG
Skandinaviendamm 212, 24109 Kiel, Germany
fon: +49 431 660 97 0, fax: +49 431 660 97 20
mailto:[EMAIL PROTECTED], http://www.splendid.de
---------------------------------------------------------------------
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