The parens are for making sure the parsing works correctly. Probably either
one works fine. Suggest you do
EXPLAIN EXTENDED ...;
SHOW WARNINGS;
I suspect that the output from each will be identical, and have more parens.
The main need for parens is to avoid associating the ORDER BY with jus
glenn
Union is 4.0 feature.
david
>Notwithstanding end-of-life status, is there an issue in MySQL
>v3.23 r.e. the "union" operator?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Jim Winstead wrote, On 1/11/2008 12:54 PM:
On Fri, Jan 11, 2008 at 12:28:05PM -0800, Glenn Gillis wrote:
Notwithstanding end-of-life status, is there an issue in MySQL v3.23
r.e. the "union" operator?
My installation returns a syntax error on any query containing the union
operator, even with
On Fri, Jan 11, 2008 at 12:28:05PM -0800, Glenn Gillis wrote:
> Notwithstanding end-of-life status, is there an issue in MySQL v3.23
> r.e. the "union" operator?
>
> My installation returns a syntax error on any query containing the union
> operator, even with the sample queries provided in the
Hi Gleb,
i finally found out a method to be entirely independent from any
character-set as well as collation-sequence problem, when forming a
UNION, where you occasionnally have to insert place-holders in one of
the SELECT statements:
as (text, varchar, char) placeholders use NULL instead of "
Hi Gleb,
localhost.(none)> show session variables like "%version%";
+-+--+
| Variable_name | Value|
+-+--+
| protocol_vers
Hello.
Some times the cause of these problems is that some fields
have different character sets or it is a bug. I suggest you
the following steps: check if the problem still exists in 4.1.16.
Then provide the create statements of your tables to the list
(they include the character set information)
"Gordon Bruce" <[EMAIL PROTECTED]> wrote on 08/26/2005 05:04:17 PM:
> It's getting late on Friday, but couldn't you build a table with all of
> the parameter combinations and then just join against that table?
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> S
It's getting late on Friday, but couldn't you build a table with all of
the parameter combinations and then just join against that table?
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 4:25 PM
To: mysql@lists.mysql.com
Subject: Union vs
>From http://dev.mysql.com/doc/mysql/en/union.html :
"Before MySQL 4.1.1, a limitation of UNION is that only the values
from the first SELECT are used to determine result column types and
lengths. This could result in value truncation if, for example, the
first SELECT retrieves shorter values than
Hello.
Check with SHOW PROCESSLIST in which state MySQL thread which performs
the query is. See:
http://dev.mysql.com/doc/mysql/en/show-processlist.html
Chris Faulkner <[EMAIL PROTECTED]> wrote:
> Hello again
>
> Following on from this index question, the UNION worked. From a norm
Most helpfull! Thanks!
This brings me to my next question I have a table that looks like this:
CREATE TABLE `Article_Search` (
> `ArticleID` int(11) NOT NULL default '0',
> `Content` text NOT NULL,
> PRIMARY KEY (`ArticleID`),
> FULLTEXT KEY `Content` (`Content`)
> ) ENGINE=MyISAM DEFAULT CHARSET
>
> Use one big table. A merge table will run the same query over
> all 10 tables. The key buffer is filled from the top down so
He is using a fulltext index he can't use merge tables.
If he where to UNION across the tables being used assuming he uses the
tables that only have the data he wou
Use one big table. A merge table will run the same query over all 10
tables. The key buffer is filled from the top down so if you have a key
buffer that looks like this:
a
/ \
/\
b c
/ \/ \
de fg
Almos
Use 10 smaller tables and perform a union. It's faster to look up in
smaller tables then larger ones-generally. Additionally more of the
key_buffer can be used for tables with the most hits over the tables
with less hits, making the lookup sustain speed over time.
> -Original Message-
>
Chris <[EMAIL PROTECTED]> wrote on 04/02/2005 12:35:57 AM:
> Tom Crimmins wrote:
>
> >On Friday, April 01, 2005 19:27, Chris wrote:
> >
> >
> >
> >>Hi all,
> >>
> >>I've got 3 or 4 queries UNIONed together in a single query. I want to
> >>GROUP the UNIONed result, by one field, and SUM() another
Tom Crimmins wrote:
On Friday, April 01, 2005 19:27, Chris wrote:
Hi all,
I've got 3 or 4 queries UNIONed together in a single query. I want to
GROUP the UNIONed result, by one field, and SUM() another field.
Is that possible in one query, or will I need to use temporary table
and group it from
On Friday, April 01, 2005 19:27, Chris wrote:
> Hi all,
>
> I've got 3 or 4 queries UNIONed together in a single query. I want to
> GROUP the UNIONed result, by one field, and SUM() another field.
>
> Is that possible in one query, or will I need to use temporary table
> and group it from that?
Ha!
Thx Michael, your first suggestion (reversing the order of the UNION
terms) worked like a charm.
greetz,
Stijn
Michael Stassen wrote:
Stijn Verholen wrote:
Jigal van Hemert wrote:
Here is my solution:
(SELECT ID, referentie, postcode, gemeente,
kadastrale_opp,prijs_zichtbaar, verkoopprijs, st
Stijn Verholen wrote:
Jigal van Hemert wrote:
Here is my solution:
(SELECT ID, referentie, postcode, gemeente,
kadastrale_opp,prijs_zichtbaar, verkoopprijs, status, adres, '' AS
hoofdtype FROM gronden WHERE status = 'te koop' ) UNION (SELECT ID,
referentie, postcode, gemeente, kadastrale_opp, prijs
Jigal van Hemert wrote:
Here is my solution:
(SELECT ID, referentie, postcode, gemeente,
kadastrale_opp,prijs_zichtbaar, verkoopprijs, status, adres, '' AS
hoofdtype FROM gronden WHERE status = 'te koop' ) UNION (SELECT ID,
referentie, postcode, gemeente, kadastrale_opp, prijs_zichtbaar,
verkooppri
> Here is my solution:
> (SELECT ID, referentie, postcode, gemeente,
> kadastrale_opp,prijs_zichtbaar, verkoopprijs, status, adres, '' AS
> hoofdtype FROM gronden WHERE status = 'te koop' ) UNION (SELECT ID,
> referentie, postcode, gemeente, kadastrale_opp, prijs_zichtbaar,
> verkoopprijs, doel AS
Lana,
> You have been asking this question for quite a while now. I think that you
> do not have a satisfactory answer yet because I do not believe there is an
> EXCEPT operator in the MySQL vocabulary. If you could post a link to the
> page from the MySQL manual that shows this operator, we can
Lana,
You have been asking this question for quite a while now. I think that you
do not have a satisfactory answer yet because I do not believe there is an
EXCEPT operator in the MySQL vocabulary. If you could post a link to the
page from the MySQL manual that shows this operator, we can help
SELECT DISTINCT study FROM table WHERE keyword='chemistry';
- Of course if it's 'chemistry' it IS <> ''computers' or anything else
'chemistry' <> 'computers'
so last part ot your SQL statement is obsolete
L a n a wrote:
Hello,
I've had a problem trying to get working except operator in mysql:
sta
L a n a wrote:
Hello,
I've had a problem trying to get working except operator in mysql:
statement "SELECT study from table WHERE keyword = 'chemistry' NOT
keyword = 'computers'" returns SQL error
Of course. NOT is an operator, not a connector. That is, "NOT keyword =
'computers'" has the oppo
I don't think there's anything conceptually wrong with what you're doing.
Most relational databases let you UNION together many more than 3 queries; I
assume MySQL also allows this.
I don't see any obvious syntax error jumping out at me. What error message
are you getting?
I suspect that you are
I have no idea if this will actually work but I believe that if we use the
documented behavior of "anonymous views" to encapsulate the UNION query,
we may be able to build a single two-stage query that could resolve your
issue. Please let the list know if this works or not. I do know of another
"Ed Reed" <[EMAIL PROTECTED]> wrote:
> Can anyone tell me how to sort the combined results of a Union query?
> Right now I have a Group By and Order By in both of my queries that make
> up my Union but the results are grouped and sorted within the two
> queries but not between the two queries. The
And if you're sorting by Name in the end, you don't really need to sort
by Name in each SELECT:
(SELECT Name FROM Employee Group By Name)
UNION
(SELECT Name FROM Consultant Group By Name)
ORDER BY Name;
Do you expect the same Name in multiple rows in these tables? If not,
you can drop t
Thanks Jeremy,
That was easy.
- Ed
>>> Jeremy March <[EMAIL PROTECTED]> 3/12/04 7:42:12 PM >>>
> Can anyone tell me how to sort the combined results of a Union
query?
>
> (Select Name From Employee Group By Name Order By Name)
> Union (Select Name From Consultant Group By Name Order By Name);
> Can anyone tell me how to sort the combined results of a Union query?
>
> (Select Name From Employee Group By Name Order By Name)
> Union (Select Name From Consultant Group By Name Order By Name);
>
Just add another order by on the end after the parenthesis:
(Select Name From Employee Group B
"Lorderon" <[EMAIL PROTECTED]> wrote:
>> the only why i know how to do this is to write the ind sums to a new table
>> and then sum that table..
>
> How you do it with a new table?
CREATE TEMPORARY TABLE table3
(SELECT SUM(price) as column1 FROM table1)
UNI
A union is designed to integrate two+ result sets into one. Can you not
just join the tables together and perform a sum in the select clause?
>> Original Message <<
On 3/2/04, 3:46:30 PM, Lorderon <[EMAIL PROTECTED]> wrote regarding
UNION:
> Hello All,
> I wan
> the only why i know how to do this is to write the ind sums to a new table
> and then sum that table..
How you do it with a new table?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Thanks for your help... appreciate it...
MERGE table type is what I searched for :-)
Thanks
-Lorderon
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
At 19:18 +0200 2/24/04, Lorderon wrote:
"Paul DuBois" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
At 19:04 +0200 2/24/04, Lorderon wrote:
>Is there a way to make concat 2 tables together without using UNION ?
>The tables are EXACTLY SAME, but they sit on 2 different DBs.
>And I
Would creating a merge table be a solution for you?
>> Original Message <<
On 2/24/04, 11:04:53 AM, Lorderon <[EMAIL PROTECTED]> wrote regarding
Union EXACT Tables:
> Hello All,
> Is there a way to make concat 2 tables together without using UNION ?
> The table
"Paul DuBois" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> At 19:04 +0200 2/24/04, Lorderon wrote:
> >Is there a way to make concat 2 tables together without using UNION ?
> >The tables are EXACTLY SAME, but they sit on 2 different DBs.
> >And I want to run the SAME where clause on
At 19:04 +0200 2/24/04, Lorderon wrote:
Hello All,
Is there a way to make concat 2 tables together without using UNION ?
The tables are EXACTLY SAME, but they sit on 2 different DBs.
And I want to run the SAME where clause on both tables...
What's the problem with using UNION?
--
Paul DuBois, MyS
Thanks Bill; the first example did exactly what I wanted. I didnt need the
"where" clause though; obviously didnt explain myself clearly!
I am sure I tried something similar to that, but I am used to MS SQL 7 and
started sticking brackets everywhere which must have caused the errors I was
getting.
Of course,
But you still can see the table structure???
Hans
At 16:05 15-10-03 +0200, you wrote:
2003-10-15 kl. 15.51 skrev Hans van Dalen:
Table1 contains: A and B and C
Table2 contains: B and C and D
all varchars
The query:
select A, B, C, '' as D from Table1
UNION
select '' as A, B,
for example:
Table1 contains: A and B and C
Table2 contains: B and C and D
all varchars
The query:
select A, B, C, '' as D from Table1
UNION
select '' as A, B, C, D from Table2
if the values are no varchar but for example smallints then you replace the
'' with 0 or whatever wich value (eg NULL).
Hi!
It depends, what language use you to include SQL commands. I use Java and if
I use scrollable result set I can resolv the problem inside a class.
Best regards
On Mon, 6 Oct 2003 10:00:37 +0200, Director General: NEFACOMP wrote
> Hi Group,
>
> I want to use a UNION in order to SELECT column
it's not expected behavior, but it is documented (classical 'works as
designed, but you may not like the design' scenerio)
> -Original Message-
> From: Andy Jefferson [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 12, 2003 6:19 AM
> To: [EMAIL
>> If I do
>> SELECT THIS.PRODUCT_ID,"net.ajsoft.WebShop.Inventory.Product" AS
>> JPOXMETADATA,THIS.ID FROM PRODUCT THIS LEFT OUTER JOIN BOOK SUBCLASS0 ON
>> THIS.PRODUCT_ID = SUBCLASS0.BOOK_ID WHERE SUBCLASS0.BOOK_ID IS NULL AND
>> THIS.PRICE < .15E3
>> i get
>> ++-
Andy Jefferson <[EMAIL PROTECTED]> wrote:
>
> I'm trying to do a simple UNION in MySQL (4.0.11a on Linux). I am trying the
> following ...
>
> If I do
> SELECT THIS.PRODUCT_ID,"net.ajsoft.WebShop.Inventory.Product" AS
> JPOXMETADATA,THIS.ID FROM PRODUCT THIS LEFT OUTER JOIN BOOK SUBCLASS0 ON
> TH
Marek Lewczyk wrote:
Hello,
Currently I'm testing my app using MySQL 4.1.0 version, and I have a
strange error during execution a union query.
(SELECT IF(_DAT.pri <=> null, null, ROUND(_DAT.pri/1.22)) AS pri_net,
IF(_DAT.pri <=> null, null, ROUND(_DAT.price*1)) AS pri_gross,
_DAT.cuid, _CUR.code FR
One more thing: the question isn't "how to solve the problem" - becouse
it's very easy, but "wy it's working on 4.0.14 and not on 4.1.0".
> -Original Message-
> From: Marek Lewczyk [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2003 4:15 PM
> To: [EMAIL PROTECTED]
> Subject: "union"
Neculai Macarie wrote:
>> To my observations constants in a column declaration limit the
>> column width to just fit the initial constant.
>> Your choice of values 'gallary' and 'gallery-categ' just masked that
>> out ;-)
> Yes, you are right. Based on your observation I was able to trick him
> wit
> Neculai Macarie wrote:
> []
> > select 'gallery' as table_name, d_image_small, d_image_big
> > from gallery
> > UNION
> > select 'gallery_categ' as table_name, d_image, NULL
> > from gallery_categ
> > order by table_name;
> []
> > select 'gallery' as table_name, d_image_small, d_image_big
> > fr
Neculai Macarie wrote:
[]
> select 'gallery' as table_name, d_image_small, d_image_big
> from gallery
> UNION
> select 'gallery_categ' as table_name, d_image, NULL
> from gallery_categ
> order by table_name;
[]
> select 'gallery' as table_name, d_image_small, d_image_big
> from gallery
> union
> se
Gary,
The if() function often allows you to replace a union query. For example
this may work for you - watch the LIMIT it operates AFTER the sort so
your sort needs to put the records which you want at the front:
SELECT user_id, username, last_login, if(last_team = 380, 1, 2) as
SortOrder FROM use
On Friday 28 March 2003 19:29, James wrote:
> It seems that the union has problems when some values returned in the
> selects are nulls like in left joines. Instead of seeing Nulls the rows
> inherit the value of the previous row. Which make a real mess. I did how
> ever found a work around. I use
It is a mySQL UNION "problem" referenced in a couple of places on the web.
Basically, the topmost query must not select NULL, and must select character
placeholders for the largest possible piece of data that may be present in each
column, and also select zero for number columns. What is unfortun
On Thu, Mar 20, 2003 at 10:32:07AM -0600, Dan Nelson wrote:
> In the last episode (Mar 20), Fred van Engen said:
> > > See msg 135092 for sample script if you want to see a physical example.
> >
> > Which message is 135092? I'm reading a mailing list, not a newsgroup.
>
> The mailing list softwar
In the last episode (Mar 20), Fred van Engen said:
> > See msg 135092 for sample script if you want to see a physical example.
>
> Which message is 135092? I'm reading a mailing list, not a newsgroup.
The mailing list software at mysql.com does number each message, and
even though the archive web
Hi,
On Thu, Mar 20, 2003 at 06:38:04AM -0800, Mike Lemke wrote:
> The topmost query in a series of queries, each connected by UNION ALL, dictates
> the allocated space for data in each column for the resulting row set! This is
> very bad - and makes the UNION useless.
>
This is as documented in
Hello.
On Mon 2002-12-09 at 10:56:21 +0530, [EMAIL PROTECTED] wrote:
> MySQL 3.23.53
>
> I have a table T1 and want to do something like
>
> SELECT * FROM T1 WHERE A = 1 AND xxx...
> UNION
> SELECT * FROM T1 WHERE A = 2 AND yyy...
>
> Don't read to much in the WHERE clause, this is just for que
Dan,
Wednesday, May 22, 2002, 7:16:50 PM, you wrote:
DL> Could somebody tell me what is wrong with this query?
DL> select location from visiExPr where location=1 union (select location from
demandInfoAd where location=0);
DL> ERROR 1064: You have an error in your SQL syntax near 'union (select
ing? UNION is implemented in 4.0.0. IF
you have 3.x.x it won't work...
Gurhan
-Original Message-
From: Gurhan Ozen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 12:31 PM
To: Dan Liu; >
Subject: RE: Union does not work
Sub-selects are not permitted in MySQ
12:31 PM
To: Dan Liu; >
Subject: RE: Union does not work
Sub-selects are not permitted in MySQL yet..
See: http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html
Gurhan
-Original Message-
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 11:58 AM
To: >
Subject:
Hi,
Perhaps try to remove the brackets ?
SELECT location FROM visiExPr where location=1 UNION SELECT location FROM
visiExPr where location=0;
(I assume you're using MySQL 4.0.x ?)
Regards,
Jocelyn Fournier
- Original Message -
From: "Dan Liu" <[EMAIL PROTECTED]>
To: ">" <<[EMAIL PRO
Dan,
Wednesday, May 22, 2002, 6:57:49 PM, you wrote:
DL> Could anybody tell me why the following query does not work?
DL> SELECT location FROM visiExPr where location=1 union (SELECT location FROM
visiExPr where location=0);
DL> Thanks!
What exactly doesn't work? Have you got an error or wrong
Sub-selects are not permitted in MySQL yet..
See: http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html
Gurhan
-Original Message-
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 11:58 AM
To: >
Subject: Union does not work
Hi,
Could anybody tell me why the foll
Walter D. Funk writes:
> Thanks for your answer,
>
> I´ve created a TEMPORARY table and it seems to work well for my purpose,
> the only doubt I still have is, if the table gets automatically deleted when
> the user
> closes the connection, or should I do something within my script to avoid a
> s
Sent: Friday, January 04, 2002 3:45 PM
Subject: Re: UNION
> You have to search for "create temporary" table then make
> severals
> insert into this_table as select
>
> Note that the temporary table are thread local I think so only the current
> connexion can see it.
&g
You have to search for "create temporary" table then make
severals
insert into this_table as select
Note that the temporary table are thread local I think so only the current
connexion can see it.
> HI,
>
> I found a very usefull function in Mysql (to combine the result of many
> SELECTS
> For the questions...
> select tekst || tekst2 total from table;
> should return a virtual column called total with as value
> testtest
> it returns a virtual column called total alright on it's value is 0
> I also tried this with + instead of || in oracle this should give
> an error
> sinc
I need to do this seemingly simple thing in mySQL:
SELECT SUM(wucount), SUM(genecount) FROM genomestats WHERE curDate IN
('09-09-2001 9:30:00', '09-09-2001 12:30:00');
However, the SUM() returns the SUM of both dates. However, I could do
SELECT SUM(wucount), SUM(genecount) from genomestats WHER
>Hello!
>My company curently use microsoft SQL, we discover the MySQL database few
>weeks ago and we really impressed, but i have a few problems becouse my
>querys use the union select which is not acceptet by MySQL, for example:
Sir, it would be a bad idea to continue trying to convert your SQL
> Hello!
> My company curently use microsoft SQL, we discover the MySQL database few
> weeks ago and we really impressed
YES! Another convert! :-)
> , but i have a few problems becouse my
> querys use the union select which is not acceptet by MySQL, for example:
Bob Hall has a couple of good su
72 matches
Mail list logo