Hi,
I'm confusion with your issue. Can you show us your detailed wanted?
David Yeung, In China, Beijing.
My First Blog:http://yueliangdao0608.cublog.cn
My Second Blog:http://yueliangdao0608.blog.51cto.com
My Msn: yueliangdao0...@gmail.com
2010/12/1 Mohan L
> Dear All,
>
> My Mysql Table co
Many thanks for your query, seems we need to group it like Wolfgang's
does.
Willy
On Thu, 2009-09-03 at 22:33 -0700, Manasi Save wrote:
> may be you can use IN clause:
>
> SELECT SUM(price)*0.5 AS price1, SUM(price)*0.65 AS price2 FROM table
> WHERE partner IN ('A', 'B');
>
--
MySQL Gene
Many thanks for the query. It works ;)
Willy
On Fri, 2009-09-04 at 08:09 +0200, Wolfgang Schaefer wrote:
> sangprabv wrote:
> > I have these query:
> > SELECT SUM(price)*0.5 AS price1 FROM table WHERE partner = 'A';
> > SELECT SUM(price)*0.65 AS price2 FROM table WHERE partner = 'B';
> > Is it
sangprabv wrote:
> I have these query:
> SELECT SUM(price)*0.5 AS price1 FROM table WHERE partner = 'A';
> SELECT SUM(price)*0.65 AS price2 FROM table WHERE partner = 'B';
> Is it possible to make the queries into 1 single query? How to make it
> happen? Many thanks for helps.
>
>
>
> Willy
>
>
>
may be you can use IN clause:
SELECT SUM(price)*0.5 AS price1, SUM(price)*0.65 AS price2 FROM table
WHERE partner IN ('A', 'B');
--
Thanks and Regards,
Manasi Save
Artificial Machines Pvt Ltd.
> I have these query:
> SELECT SUM(price)*0.5 AS price1 FROM table WHERE partner = 'A';
> SELECT SUM
Because these are two quite distinct queries, I don't see an immediate way of
joining them that would make them more efficient. Something that comes to mind
are sub-select statements for example, but that would make this more complex
than it needs to be.
Like Robert said, you aren't giving us
What I'm looking for is to SUM the price from partner A and B with each
result. So the result I expect is like "Partner A total's price 123,
Partner B total's price 456". Can you give me the query example? TIA.
Willy
On Thu, 2009-09-03 at 23:11 -0400, Robert Citek wrote:
> It's not clear what
It's not clear what exactly you are looking for. Two possible solutions:
1) use a union
2) use a join with another table containing partner and factor fields.
Can you give a short example of what the input looks like and what you
would like the output to look like?
Regards,
- Robert
On Thu, S
Brian,
I think the answer is to create a sub query,
Without your tables I can't test this transcription, but the trick is
straightforward: if the first query includes the column(s) required to
join it correctly to the 2nd query, replace the avgscore table reference
in the second query with
In a nutshell, one way to do subqueries is to just name the query and join on
it as if it was a regular table.
SELECT field1,field2,... FROM table1
INNER JOIN table2 ON field1=fieldT2
INNER JOIN (SELECT fieldA, fieldB FROM tableA WHERE ...) AS table3
ON fieldA=field1
...
More commonly people
On Sat, May 06, 2006 at 12:55:55PM +0100, Peter Rosenthal wrote:
> Out of interest is there any time on the roadmap to improve the query
> optimizer's handling of sub-queries as specified in
> http://dev.mysql.com/doc/refman/5.0/en/subquery-restrictions.html ?
As Timour previewed at his "Speeding
Hello.
Not enough information to make a conclusion. At least for me
this query didn't return any error:
mysql> create table messages(id int);
Query OK, 0 rows affected (0.02 sec)
mysql> create table message_push_notifications(message_id int);
Query OK, 0 rows affected (0.01 sec)
mysq
That's pretty hard to do; you haven't said what the query is trying to do
and you haven't supplied definitions of the tables you are using or provided
a few rows of sample data so that we could form a mental picture of what you
are trying to accomplish. Also, you haven't stated what version of MySQ
Herman Scheepers <[EMAIL PROTECTED]> wrote on 11/13/2005 11:53:23 AM:
> Hi
>
> Could anyone help perhaps tell me why the following
> simple query containing a sub-query gives a syntax
> error.
>
> select 1 from messages
> where not exists ( select 1 from
> message_push_notifications
>
[EMAIL PROTECTED] wrote:
My suggestion: Don't use a subquery, use a temp table (
http://dev.mysql.com/doc/mysql/en/rewriting-subqueries.html)
CREATE TEMPORARY TABLE tmpDupes (KEY (`Barang`))
SELECT `Barang`
FROM Barang
GROUP BY Barang
HAVING count(1) >1;
Select b.`BrgId`, b.`Kode`, b.`Barang`
Hendro Suryawan <[EMAIL PROTECTED]> wrote on 05/25/2005 06:23:52 PM:
> Hi Mathias,
> Thanks for your suggestion, but i run this query to find multiple
> records with the same name in field barang (double records). And the
> results i found 94 rows at 54813 ms. I try your idea and the result is
Hi Mathias,
Thanks for your suggestion, but i run this query to find multiple
records with the same name in field barang (double records). And the
results i found 94 rows at 54813 ms. I try your idea and the result is
the same. So i think mysql not optimized for this kind sub query.
Do you hav
hi,
don't listen to last email.
since the two first rows are unique, you can't use my example.
Just create an index as i said, and play your query :
Select BrgId, Kode, Barang From Barang Where Barang in
(Select Barang From Barang Group By Barang Having Count(*) > 1 )
Mathias
Selon [EMAIL PRO
I rerezad you and discovered that (BrgId, Kode) is UNIQUE.
your query will return no rows :o)
spending 54813 ms for nothing.
Mathias
Selon [EMAIL PROTECTED]:
> Hi,
> You may have the same table structure in MS, but not the same table definiton
> :
> constraints+indexes+stats !
>
> try :
> creat
Hi,
You may have the same table structure in MS, but not the same table definiton :
constraints+indexes+stats !
try :
create index toto on Barang(BrgId, Kode, Barang);
Select BrgId, Kode, Barang From Barang
Group By Barang
Having Count(*) > 1 ;
Mathias
Selon Hendro Suryawan <[EMAIL PROTECTED
sam wun <[EMAIL PROTECTED]> wrote on 01/20/2005 11:45:40 AM:
>
> [EMAIL PROTECTED] wrote:
>
> >
> >
> > SELECT DISTINCT i.basename
> > FROM inventory i
> > INNER JOIN transaction t
> > ON i.prodcode = t.prodcode
> > AND t.date >= '2004-01-01'
> > AND t.date <= '2004-01-31
[EMAIL PROTECTED] wrote:
SELECT DISTINCT i.basename
FROM inventory i
INNER JOIN transaction t
ON i.prodcode = t.prodcode
AND t.date >= '2004-01-01'
AND t.date <= '2004-01-31'
INNER JOIN transaction tt
ON i.prodcode = tt.prodcode
AND tt.date >= '2005-01-01'
[EMAIL PROTECTED] wrote:
I would simplify it by converting everything to us explicit (not
implicit) JOIN statements,skipping unnecessary type conversions, and
logically merging your conditions. Here is your original query,
slightly reformatted.
SELECT DISTINCT i.basename
FROM inventory i, tran
is probably the largest table?
Andy
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 19 January 2005 15:04
> To: sam wun
> Cc: mysql@lists.mysql.com
> Subject: Re: sub query is extermely slow
>
> sam wun <[EMAIL PROTECTED]> wrote on
sam wun <[EMAIL PROTECTED]> wrote on 01/19/2005 07:02:37 AM:
> Hi list,
>
> The following sql statement takes 3 mintues to complete the query. How
> can I improve its speed?
> select DISTINCT i.basename from inventory i, transaction t, customer c
> where i.prodcode = t.prodcode and c.custcode =
Check ALTER statement in MySQL doc. It explains how to add/modify an index
after a table has been created.
> -Original Message-
> From: sam wun [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 19, 2005 10:00 AM
> Cc: mysql@lists.mysql.com
> Subject: Re: sub query is
add index to a field after a table is created?
Thanks
Sam
Clint
From: sam wun <[EMAIL PROTECTED]>
To: Clint Edwards <[EMAIL PROTECTED]>
CC: mysql@lists.mysql.com
Subject: Re: sub query is extermely slow
Date: Wed, 19 Jan 2005 22:05:58 +0800
Clint Edwards wrote:
Sam,
Can you send the
ROTECTED]>
To: Clint Edwards <[EMAIL PROTECTED]>
CC: mysql@lists.mysql.com
Subject: Re: sub query is extermely slow
Date: Wed, 19 Jan 2005 22:05:58 +0800
Clint Edwards wrote:
Sam,
Can you send the following information:
When was the last time 'analyze table ' (inventory,
transact
LIKE '%buffer%';":
Clint
From: sam wun <[EMAIL PROTECTED]>
To: Clint Edwards <[EMAIL PROTECTED]>
CC: mysql@lists.mysql.com
Subject: Re: sub query is extermely slow
Date: Wed, 19 Jan 2005 20:39:41 +0800
Clint Edwards wrote:
Sam,
Can you send the output of the following:
Clint Edwards wrote:
Sam,
Can you send the output of the following:
#>explain \G
Thanks for the suggestion, here is the output of the explain query:
mysql> explain select DISTINCT i.basename from inventory i, transaction
t, customer c where i.prodcode = t.prodcode and c.custcode = t.custcode
and
Sam,
Can you send the output of the following:
#>explain \G
Clint
From: sam wun <[EMAIL PROTECTED]>
To: mysql@lists.mysql.com
Subject: sub query is extermely slow
Date: Wed, 19 Jan 2005 20:02:37 +0800
Hi list,
The following sql statement takes 3 mintues to complete the query. How can
I improve its
Oooo...Oo. thank you very much for you
information.
I better migrate my database to postgres.
I'll use MySQL back after MySQL 4.1 stable version
released on SuSE Distro.
--- Jigal van Hemert <[EMAIL PROTECTED]> wrote:
> > I don#t understand why subquery on my MySQL
> 4.0.18-Mas
> > does not v
Jigal van Hemert wrote:
I don#t understand why subquery on my MySQL 4.0.18-Mas
does not valid.
select * from salesreport where custid in
(select custid from appointment where done='N');
Simple reason: v. 4.0.18 does not support subqueries yet. Use 4.1 or later.
Regards, Jigal.
Or, rewrite the quer
> I don#t understand why subquery on my MySQL 4.0.18-Mas
> does not valid.
Simple reason: v. 4.0.18 does not support subqueries yet. Use 4.1 or later.
Regards, Jigal.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL P
"Lorderon" <[EMAIL PROTECTED]> wrote:
> Since I don't use MySQL 4.1, is this query OK?
>
> SELECT SQL_CALC_FOUND_ROWS * FROM
>((SELECT * FROM t1 WHERE id>100 GROUP BY country)
>UNION ALL
> (SELECT * FROM t2 WHERE id>150 GROUP BY country)
>LIMIT 0,10);
>
> I want this to re
Chris Knipe wrote:
Lo all,
What's the format for a sub query in MySQL??
I've tried the below with a few variants but I can't seem to get it
sorted...
SELECT songlist.ID AS ID,
songlist.duration AS Duration,
songlist.artist AS Artist,
songlist.title AS Title,
songlist.file
RRamasamymani,
Friday, April 26, 2002, 2:32:01 PM, you wrote:
R> It seems that sub queries are not supported in MySQL Version-3.23.48.
You can use JOIN instead of sub-selects, look at:
http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html
http://www.mysql.com/doc/J/O/JOIN.html
R> In t
Hi
Sub-Selects are not supported, yet, regardless of OS
At 02:25 16/01/2001 +, SED wrote:
>Hi,
>
>I'm trying to execute the following (as told in MySQL-Manual):
>
> mysql> SELECT article, dealer, price
> -> FROM shop
> -> WHERE price=(SELECT MAX(price) FROM shop)
>
38 matches
Mail list logo