dbTalk Databases Forums  

merging two tables in a select?

comp.databases.mysql comp.databases.mysql


Discuss merging two tables in a select? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
The Natural Philosopher
 
Posts: n/a

Default merging two tables in a select? - 11-19-2010 , 06:59 PM






I have tow tables, that are slightly different because they cover tow
slightly different ways of accessing data - one is URLS and the other is
BLOB stored downloadable material - but I want to make them seamless in
user land so they click on something, and whether its coming out of the
database or being pulled off a remote site is not apparent.

Is there a single query that can take fields from two tables and merge
them under the same name and sort on that?

Like

select name.table_one and name.table_two as munged_name sort by munged_name

etc etc..

Reply With Quote
  #2  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: merging two tables in a select? - 11-19-2010 , 10:09 PM






On 2010-11-20 01:59, The Natural Philosopher wrote:
Quote:
I have tow tables, that are slightly different because they cover tow
slightly different ways of accessing data - one is URLS and the other is
BLOB stored downloadable material - but I want to make them seamless in
user land so they click on something, and whether its coming out of the
database or being pulled off a remote site is not apparent.

Is there a single query that can take fields from two tables and merge
them under the same name and sort on that?

Like

select name.table_one and name.table_two as munged_name sort by munged_name
Sounds like a union

select ... from T1
union
select ... from T2
order by ...


/Lennart

Reply With Quote
  #3  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: merging two tables in a select? - 11-20-2010 , 04:40 AM



Lennart Jonsson wrote:
Quote:
On 2010-11-20 01:59, The Natural Philosopher wrote:
I have tow tables, that are slightly different because they cover tow
slightly different ways of accessing data - one is URLS and the other is
BLOB stored downloadable material - but I want to make them seamless in
user land so they click on something, and whether its coming out of the
database or being pulled off a remote site is not apparent.

Is there a single query that can take fields from two tables and merge
them under the same name and sort on that?

Like

select name.table_one and name.table_two as munged_name sort by munged_name

Sounds like a union

select ... from T1
union
select ... from T2
order by ...

Ah..never used UNION. Right. with that handy word to hang the problem
on, I now know WHICH bit of the manual to read.

TVM


Quote:
/Lennart

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.