Unix Technical Forum

concatonating 2 SELECTS into the same result set?

This is a discussion on concatonating 2 SELECTS into the same result set? within the MySQL forums, part of the Database Server Software category; --> H all, newbie here again. Is it possible to do two SELECTS in the same SQL call, and return ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
lister
 
Posts: n/a
Default concatonating 2 SELECTS into the same result set?

H all, newbie here again.

Is it possible to do two SELECTS in the same SQL call, and return the
results of both in the same result set?
(This two selects would be getting the same columns from the same
table).

Many thanks,
Lister

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:27 AM
ZeldorBlat
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Sep 17, 4:37 pm, lister <listerofsme...@hotmail.com> wrote:
> H all, newbie here again.
>
> Is it possible to do two SELECTS in the same SQL call, and return the
> results of both in the same result set?
> (This two selects would be getting the same columns from the same
> table).
>
> Many thanks,
> Lister


<http://dev.mysql.com/doc/refman/5.0/en/union.html>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:27 AM
lister
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Sep 17, 9:39 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
> <http://dev.mysql.com/doc/refman/5.0/en/union.html>


You're a star! Thanks a million. :-)


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 11:27 AM
ZeldorBlat
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Sep 17, 4:48 pm, lister <listerofsme...@hotmail.com> wrote:
> On Sep 17, 9:39 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
>
> > <http://dev.mysql.com/doc/refman/5.0/en/union.html>

>
> You're a star! Thanks a million. :-)


Not really. All I did was read the manual.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 11:27 AM
Paul Lautman
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

ZeldorBlat wrote:
> On Sep 17, 4:48 pm, lister <listerofsme...@hotmail.com> wrote:
>> On Sep 17, 9:39 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
>>
>>> <http://dev.mysql.com/doc/refman/5.0/en/union.html>

>>
>> You're a star! Thanks a million. :-)

>
> Not really. All I did was read the manual.


About 70% of the questions that I answer on this form I do so simply by
reading the manual.

Posters could save a lot of time by doing similar.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-28-2008, 11:27 AM
subtenante
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Tue, 18 Sep 2007 10:34:54 +0100, "Paul Lautman"
<paul.lautman@btinternet.com> wrote:

>About 70% of the questions that I answer on this form I do so simply by
>reading the manual.
>
>Posters could save a lot of time by doing similar.


Not when you don't know where to look.

I have read a lot of parts of the manual, and still can ask silly
questions here from time to time, because I missed something. It takes
30 seconds to somebody who knows, while it can take me more than one
hour to go to the very deep footnotes completely missing the headline,
because I thing I already read it.

And worse in that case : OP did not know that the correct word to look
for was union, he thought it was concatenate ; browsing the manual
would have been for this a waste of time. Now he knows where to read,
that's very valuable information that the manual can not give him
without a thorough review of it, which would take hours.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-28-2008, 11:27 AM
lister
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Sep 18, 10:34 am, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> ZeldorBlat wrote:
> > On Sep 17, 4:48 pm, lister <listerofsme...@hotmail.com> wrote:
> >> On Sep 17, 9:39 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> >>> <http://dev.mysql.com/doc/refman/5.0/en/union.html>

>
> >> You're a star! Thanks a million. :-)

>
> > Not really. All I did was read the manual.

>
> About 70% of the questions that I answer on this form I do so simply by
> reading the manual.
>
> Posters could save a lot of time by doing similar.


I appreciate it must be frustrating for you, but finding anything in
the online mysql manual seems extremely difficult IMHO. Even when I
know the keyword it seems difficult to find the manual page for it.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-28-2008, 11:27 AM
subtenante
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Wed, 19 Sep 2007 00:56:26 -0700, lister
<listerofsmeg01@hotmail.com> wrote:

>I appreciate it must be frustrating for you, but finding anything in
>the online mysql manual seems extremely difficult IMHO. Even when I
>know the keyword it seems difficult to find the manual page for it.


I downloaded a CHM version. It's findable on any P2P thing. Search for
MySQL CHM. If you are under linux, there are some chm viewers (I use
gnochm, because of gnome, but you can find a few others).
It lets you make searches in the whole document easily, and you always
have it offline.
It's *very* valuable.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-28-2008, 11:27 AM
subtenante
 
Posts: n/a
Default Re: concatonating 2 SELECTS into the same result set?

On Wed, 19 Sep 2007 00:56:26 -0700, lister
<listerofsmeg01@hotmail.com> wrote:

>I appreciate it must be frustrating for you, but finding anything in
>the online mysql manual seems extremely difficult IMHO. Even when I
>know the keyword it seems difficult to find the manual page for it.


Actually you can even get it from the MySQL website !
http://dev.mysql.com/doc/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:03 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com