Re: UNION ALL query help

Re: UNION ALL query help

am 25.04.2010 00:17:16 von Ron Piggott

--=-efqpogTYNYvKn3EiSQY2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Ok. I have received help and got it fixed. I didn't have the variables
matching the first query. I haven't done a UNION ALL recently. Thanks.
Ron

--=-efqpogTYNYvKn3EiSQY2--

UNION ALL query help

am 25.04.2010 02:50:20 von ron.piggott

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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: UNION ALL query help

am 26.04.2010 09:48:45 von maarten.foque

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:
>=20
> Unknown column 'title' in 'field list'
>=20
> from the query below. I am not understanding what I have done wrong. Th=
e
> goal of the query is with for a RSS feed determining the 15 most current
> articles.
>=20
> Ron
>=20
>=20
>=20
> SELECT title, content_date, content, reference FROM ( (
>=20
> SELECT `page_title`, `last_update`, 'article', `reference` FROM
> `user_pages` WHERE `include_in_highlights` =3D1 ORDER BY `last_update` DE=
SC
> LIMIT 15
>=20
> ) UNION ALL (
>=20
> SELECT `blog`.`entry_title`, `blog`.`entry_date`, `blog`.`entry`,
> `blog`.`reference` FROM blog WHERE blog_owners_reference =3D1 ORDER BY
> blog.entry_date DESC, blog.reference DESC LIMIT 15
>=20
> ) ) AS rss_feed ORDER BY rss_feed.content_date DESC LIMIT 15
>=20
>=20


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php