append query after another
append query after another
am 04.10.2005 12:03:55 von Cadbury
hi
is it possible, for any reason, to append another sql
query after one sql query?
for example, the first one is "select name from bla
bla where name=something" and we just add another
query at the end of the query to make something like
"select name from bla bla where name=something and
then show table from this database"
is it possible to do something like this?
any help is greatly appreciated. thanks
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
RE: append query after another
am 04.10.2005 14:33:35 von Leif Johnston
SQL with fundamentally support it, but in communicating with MySQL you need
to be careful to understand what you are doing. The result of your proposed
query would be the same as the final query since that is what would be
returned in the results set.
You can union to queries which sounds closer to what you are after, but
realistically the only time that a set of SQL statements make sense is when
you are implementing some process (and insert followed by and update on a
different table then a final selection). But from a programmatic side, each
step should be isolated to understand any failure condition that might
happen.
So the long answer is yes, but you shouldn't use that capability. Union( and
its counterparts...) is available to join query results sets but each query
should be distinct from programming implementation. If you are trying to
combine queries for processing then stored procedures are a valid option
since they provide the programming controls and DB side native processing.
Leif
-----Original Message-----
From: Cadbury [mailto:codename13th@yahoo.com]
Sent: Tuesday, October 04, 2005 6:04 AM
To: win32@lists.mysql.com
Subject: append query after another
hi
is it possible, for any reason, to append another sql
query after one sql query?
for example, the first one is "select name from bla
bla where name=something" and we just add another
query at the end of the query to make something like
"select name from bla bla where name=something and
then show table from this database"
is it possible to do something like this?
any help is greatly appreciated. thanks
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:
http://lists.mysql.com/win32?unsub=leif@technologycatalyst.c om
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: append query after another
am 04.10.2005 14:51:42 von leo.divinagraciaiii
yes, it's called nested queries.
version 4.1 (and up) has it. too bad it wasnt implemented for so
long... :(
version 5.x will have VIEWS.
wait... are you asking about sql queries or sql STATEMENTS???
Cadbury wrote:
> hi
>
> is it possible, for any reason, to append another sql
> query after one sql query?
> for example, the first one is "select name from bla
> bla where name=something" and we just add another
> query at the end of the query to make something like
> "select name from bla bla where name=something and
> then show table from this database"
>
> is it possible to do something like this?
>
> any help is greatly appreciated. thanks
>
--
Leo G. Divinagracia III
leo.divinagraciaiii.csueastbay.edu
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: append query after another
am 04.10.2005 15:36:24 von SGreen
--=_alternative 004A6BA785257090_=
Content-Type: text/plain; charset="US-ASCII"
Cadbury wrote on 10/04/2005 06:03:55 AM:
> hi
>
> is it possible, for any reason, to append another sql
> query after one sql query?
> for example, the first one is "select name from bla
> bla where name=something" and we just add another
> query at the end of the query to make something like
> "select name from bla bla where name=something and
> then show table from this database"
>
> is it possible to do something like this?
>
> any help is greatly appreciated. thanks
>
>
What you want to do depends entirely on how you are interacting with the
MySQL server. How do you interact with the MySQL server? What version of
each (client and server) are you using? Are you using your client tool(s)
in a scripted or coded context or are you manipulating it/them by hand?
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
--=_alternative 004A6BA785257090_=--
Re: append query after another
am 04.10.2005 16:25:28 von Charles Mabbott
--NextPart_Webmail_9m3u9jl4l_16796_1128435928_0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
There is also [depending on what your doing] to select based on criteria and write to temp table; The next query would reference that temp table to further refine the data. Make sure you get everything you need from 1st pass into the temp table
--
______
_______/ Chuck \_________
| |
| www.aa8vs.org/aa8vs |
================================
The pessimist complains about the
wind; the optimist expects it to
change; the realist adjusts the
sails."
-- William Arthur Ward
--NextPart_Webmail_9m3u9jl4l_16796_1128435928_0
Content-Type: message/rfc822
From: SGreen@unimin.com
To: Cadbury
Cc: win32@lists.mysql.com
Subject: Re: append query after another
Date: Tue, 4 Oct 2005 13:36:50 +0000
Content-Type: Multipart/alternative;
boundary="NextPart_Webmail_9m3u9jl4l_16796_1128435928_1"
--NextPart_Webmail_9m3u9jl4l_16796_1128435928_1
Content-Type: text/plain; charset="US-ASCII"
Cadbury wrote on 10/04/2005 06:03:55 AM:
> hi
>
> is it possible, for any reason, to append another sql
> query after one sql query?
> for example, the first one is "select name from bla
> bla where name=something" and we just add another
> query at the end of the query to make something like
> "select name from bla bla where name=something and
> then show table from this database"
>
> is it possible to do something like this?
>
> any help is greatly appreciated. thanks
>
>
What you want to do depends entirely on how you are interacting with the
MySQL server. How do you interact with the MySQL server? What version of
each (client and server) are you using? Are you using your client tool(s)
in a scripted or coded context or are you manipulating it/them by hand?
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
--NextPart_Webmail_9m3u9jl4l_16796_1128435928_1--
--NextPart_Webmail_9m3u9jl4l_16796_1128435928_0
Content-Type: text/plain; charset=us-ascii
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
--NextPart_Webmail_9m3u9jl4l_16796_1128435928_0--
Re: append query after another
am 05.10.2005 04:00:43 von Cadbury
--- SGreen@unimin.com wrote:
> Cadbury wrote on 10/04/2005
> 06:03:55 AM:
>
> > hi
> >
> > is it possible, for any reason, to append another
> sql
> > query after one sql query?
> > for example, the first one is "select name from
> bla
> > bla where name=something" and we just add another
> > query at the end of the query to make something
> like
> > "select name from bla bla where name=something and
> > then show table from this database"
> >
> > is it possible to do something like this?
> >
> > any help is greatly appreciated. thanks
> >
> >
>
> What you want to do depends entirely on how you are
> interacting with the
> MySQL server. How do you interact with the MySQL
> server? What version of
> each (client and server) are you using? Are you
> using your client tool(s)
> in a scripted or coded context or are you
> manipulating it/them by hand?
>
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
>
>
Thanks for replying. I'm using mysql 4.1.. and
actually i'm querying mysql through my java servlet..
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: append query after another
am 05.10.2005 04:02:27 von Cadbury
--- "Leo G. Divinagracia III"
wrote:
> yes, it's called nested queries.
>
> version 4.1 (and up) has it. too bad it wasnt
> implemented for so
> long... :(
>
> version 5.x will have VIEWS.
>
> wait... are you asking about sql queries or sql
> STATEMENTS???
>
>
thanks for replying.. i think what i meant is sql
queries.. actually i'm trying to call them from my
java servlet
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: append query after another
am 05.10.2005 14:44:05 von SGreen
--=_alternative 00459E5A85257091_=
Content-Type: text/plain; charset="US-ASCII"
Cadbury wrote on 10/04/2005 10:02:27 PM:
>
>
> --- "Leo G. Divinagracia III"
> wrote:
>
> > yes, it's called nested queries.
> >
> > version 4.1 (and up) has it. too bad it wasnt
> > implemented for so
> > long... :(
> >
> > version 5.x will have VIEWS.
> >
> > wait... are you asking about sql queries or sql
> > STATEMENTS???
> >
> >
> thanks for replying.. i think what i meant is sql
> queries.. actually i'm trying to call them from my
> java servlet
>
And how does your Java servlet connect to MySQL? I can think of at least 3
ways it might use to connect; there are probably many more than that.
Basically, the ability to parse multiple statements into multiple results
is something that is worked out through the cooperation of your client
library and the server. Some client libraries support multiple results
(each statement has to return at least a status code, doesn't it?) and may
accept multiple commands per call to the database. Most designers just
stick with the single-result mode and make multiple calls.
Is there a pressing reason why you want to make more than one statement in
a single call to the database?
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
--=_alternative 00459E5A85257091_=--
RE: append query after another
am 05.10.2005 14:47:41 von Leif Johnston
And if you feel the compunction to need more that 1 step in a programmatic
unit, used stored procedures since they give you programming power "inside"
the db/db transaction...
-----Original Message-----
From: SGreen@unimin.com [mailto:SGreen@unimin.com]
Sent: Wednesday, October 05, 2005 8:44 AM
To: Cadbury
Cc: Leo G. Divinagracia III; win32@lists.mysql.com
Subject: Re: append query after another
Cadbury wrote on 10/04/2005 10:02:27 PM:
>
>
> --- "Leo G. Divinagracia III"
> wrote:
>
> > yes, it's called nested queries.
> >
> > version 4.1 (and up) has it. too bad it wasnt
> > implemented for so
> > long... :(
> >
> > version 5.x will have VIEWS.
> >
> > wait... are you asking about sql queries or sql
> > STATEMENTS???
> >
> >
> thanks for replying.. i think what i meant is sql
> queries.. actually i'm trying to call them from my
> java servlet
>
And how does your Java servlet connect to MySQL? I can think of at least 3
ways it might use to connect; there are probably many more than that.
Basically, the ability to parse multiple statements into multiple results
is something that is worked out through the cooperation of your client
library and the server. Some client libraries support multiple results
(each statement has to return at least a status code, doesn't it?) and may
accept multiple commands per call to the database. Most designers just
stick with the single-result mode and make multiple calls.
Is there a pressing reason why you want to make more than one statement in
a single call to the database?
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: append query after another
am 06.10.2005 03:43:23 von Cadbury
> And how does your Java servlet connect to MySQL? I
> can think of at least 3
> ways it might use to connect; there are probably
> many more than that.
>
> Basically, the ability to parse multiple statements
> into multiple results
> is something that is worked out through the
> cooperation of your client
> library and the server. Some client libraries
> support multiple results
> (each statement has to return at least a status
> code, doesn't it?) and may
> accept multiple commands per call to the database.
> Most designers just
> stick with the single-result mode and make multiple
> calls.
>
> Is there a pressing reason why you want to make more
> than one statement in
> a single call to the database?
>
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
I used the jdbc from www.mysql.org.
Actually there's no real reason for me to make more
than one statement in a single call to the database,
I'm just technically curious about it.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
RE: append query after another
am 06.10.2005 03:45:39 von Cadbury
--- Leif Johnston wrote:
> And if you feel the compunction to need more that 1
> step in a programmatic
> unit, used stored procedures since they give you
> programming power "inside"
> the db/db transaction...
>
Thanks for the information. Actually I've been using
them for quite sometime.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org