Reply to Re: Mix two tables in a single SELECT statement - not a join

Your name:

Reply:


Posted by jerry gitomer on 11/09/88 11:31

bizt wrote:
>>Why don't you query both datasources seperately, and then in PHP decide
>>which one to show in your unified 'resultset' ?
>
>
> Thanks for the suggestion but as well as querying tables one after the
> other, wouldnt this also restrict me to outputing them one after the
> other. I kinda need to integrate them and then probably order them by
> date.
>
> Anyway, I see I need to gain a little understanding of the UNION
> command in SQL which is fine. I have tried visiting a couple of
> websites and they suggest all selected columns need to be the same data
> type. This presents two problems for me:
>
> 1) Some columns have different names. For example, both have a text
> data type column containing the body text of each article but one is
> called 'desctext' and the other 'article'. Could this be worked around
> by using the AS command (ie. article AS desctext)?

This may be database dependent -- but I know from experience
that if you are using Oracle different column names are not a
problem.
>
> 2) The column that provides the entry date, 'createdon', there are two
> data types between the tables. One is datetime (in the format
> '2005-11-08 12:04:43' and the other timestamp ('2005-11-08
> 12:04:43+01'). Is this an issue?
>
Try it and see if it works. If it doesn't would it be feasible
to convert the datetime column to a timestamp?

> Unfortunately both tables were created a year apart and when I started
> working on the later table, this idea wasnt thought of until now.
>
> Burnsy
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация