Re: [PHP-DB] UNION ALL query help

[email protected] (maarten)
Newsgroups php.db
Message-ID <1272268125.2078.10.camel@localhost>
Your union creates a table called rss_feed.  This table has 4 columns
(page_title, last_update, article and reference) from which you try to
select the unknown column 'title'.

So basicly, exactly what your db is telling you.
If it doesn't make sense, strip the outer select and see what your
subquery returns.  That should make it more clear.

regards




On Sat, 2010-04-24 at 20:50 -0400, Ron Piggott wrote:
> I am received the error message:
> 
> Unknown column 'title' in 'field list'
> 
> from the query below.  I am not understanding what I have done wrong.  The
> goal of the query is with for a RSS feed determining the 15 most current
> articles.
> 
> Ron
> 
> 
> 
> SELECT title, content_date, content, reference FROM ( (
> 
> SELECT `page_title`, `last_update`, 'article', `reference` FROM
> `user_pages` WHERE `include_in_highlights` =1 ORDER BY `last_update` DESC
> LIMIT 15
> 
> ) UNION ALL (
> 
> SELECT `blog`.`entry_title`, `blog`.`entry_date`, `blog`.`entry`,
> `blog`.`reference` FROM blog WHERE blog_owners_reference =1 ORDER BY
> blog.entry_date DESC, blog.reference DESC LIMIT 15
> 
> ) ) AS rss_feed ORDER BY rss_feed.content_date DESC LIMIT 15
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.