The following is working, but it's the first time I've used a table join, so I 
may have it all wrong.

CREATE TABLE `familyhistory` (
  `msg_id` bigint(14) unsigned NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `family` varchar(50) NOT NULL default '',
  `message` text NOT NULL,
  PRIMARY KEY (`msg_id`),
) TYPE=MyISAM;

CREATE TABLE `familyreplies` (
  `reply_id` bigint(14) unsigned NOT NULL default '0',
  `reply_date` bigint(14) unsigned NOT NULL default '0',
  `reply_name` varchar(50) NOT NULL default '',
  `reply_message` text NOT NULL,
  PRIMARY KEY (`reply_id`),
) TYPE=MyISAM;

My query statement:
$sql =
"
  SELECT *,
  DATE_FORMAT(msg_id,'%W %D %M %Y at %l:%i %p') AS msgdate
  FROM familyhistory
  LEFT JOIN familyreplies ON msg_id = reply_id
  ORDER BY msg_id DESC
  LIMIT $pageoffset, $maxperpage
";

msg_id, reply_id and reply_date are TIMESTAMPs.
There are no conflicting names in either table, so I haven't used (table dot 
var) format.

How can I include this in my query:
DATE_FORMAT(reply_date,'%W %D %M %Y at %l:%i %p') AS reply_date
for the LEFT JOIN?

I read that it's more efficient to let MySql do the work, and not to pull the 
data and format it yourself.
Thanks, Bob.




Community email addresses:
  Post message: php-list@yahoogroups.com
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to