----- Original Message ----- From: "William Piper" > Bob wrote: <snipped some message here>
> You need to group your selects together, also it is a good idea to name > your tables in the join to keep from ambiguity issues though not > mandatory. See below: > > SELECT *, > DATE_FORMAT(h.msg_id,'%W %D %M %Y at %l:%i %p') AS msgdate, > DATE_FORMAT(r.reply_date,'%W %D %M %Y at %l:%i %p') AS myreplydate > FROM familyhistory h > LEFT JOIN familyreplies r ON h.msg_id = r.reply_id > ORDER BY msg_id DESC > LIMIT $pageoffset, $maxperpage Hi William, That did the trick. I take your point about naming tables to stop clashes in a join. I deliberately made all items different in an attempt to eliminate this, as I was struggling with it. As you say, it's not mandatory if no conflicting names, but good practice. Hadn't come across using a table alias (as your example) but just found it in my books. Saves a lot of typing. I'm trying to learn the correct way, so I will leave the table alias in. Thanks, Bob. ------------------------------ No need to make the field names unique in different tables. Just specify them in sql SELECT users.user_id FROM users .... 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