Re: sub query or something else

2009-09-03 Thread Wolfgang Schaefer
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 > > >

Re: sub query or something else

2009-09-03 Thread Manasi Save
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

Re: sub query or something else

2009-09-03 Thread Colin Streicher
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

Re: sub query or something else

2009-09-03 Thread sangprabv
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

Re: sub query or something else

2009-09-03 Thread Robert Citek
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

sub query or something else

2009-09-03 Thread sangprabv
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 -- MySQL General Mailing List For li

RE: optimize my.cnf

2009-09-03 Thread Jerry Schwartz
>-Original Message- >From: prabhat kumar [mailto:aim.prab...@gmail.com] >Sent: Thursday, September 03, 2009 1:44 PM >To: Darren Cassar >Cc: Christos Pelekis; mysql@lists.mysql.com >Subject: Re: optimize my.cnf > >Well said Darren. Its not magic :) > [JS] Actually, its voodoo :) Regards, J

Re: Query for rolling totals

2009-09-03 Thread John Daisley
Thank you Brent, much appreciated! On Thu, 2009-09-03 at 14:12 -0400, Brent Baisley wrote: > You can do this using a variable. Set the variable starting value with > a "query": > set @runningTotal := 0 > > Then add the calculation to your total: > SELECT a. trans_id ,a.tran_date,b.cat_type,a

Re: Query for rolling totals

2009-09-03 Thread Brent Baisley
You can do this using a variable. Set the variable starting value with a "query": set @runningTotal := 0 Then add the calculation to your total: SELECT a. trans_id ,a.tran_date,b.cat_type,a.payee,a.amnt, @runningTotal := @runningTotal+a.amnt AS rollingTotal from transactions a join categories b on

Query for rolling totals

2009-09-03 Thread John Daisley
Hi, Hoping someone can help me with this little issue! It seems really simple but my brain is refusing to work. We have a transactions tables like so... mysql> desc transactions; +---+--+--+-+-++ | Field | Type | Nul

Re: optimize my.cnf

2009-09-03 Thread prabhat kumar
Well said Darren. Its not magic :) Christos, you can download and run mysqlreport from http://hackmysql.com/mysqlreportguide it will give you more idea about DB serve performance. On Thu, Sep 3, 2009 at 3:07 PM, Darren Cassar wrote: > Hi Christos, > > Performance optimization is very subjective,

MySQL Community Server 5.1.38 has been released

2009-09-03 Thread Jonathan Perkin
Dear MySQL users, MySQL Community Server 5.1.38, a new version of the popular Open Source Database Management System, has been released. MySQL 5.1.38 is recommended for use on production systems. For an overview of what's new in MySQL 5.1, please see http://dev.mysql.com/doc/refman/5.1/en/my

Re: need help with relational tables/fields

2009-09-03 Thread Wolfgang Schaefer
AndrewJames schrieb: > Hey, > > i have a table called users which has my users in it, each have a uid > field. > I also have a stories table which has stories in it each with a sid field > for each story but also a uid field so i know which user the story > belongs > to. > > i want to write a que

Re: need help with relational tables/fields

2009-09-03 Thread Wolfgang Schaefer
AndrewJames schrieb: > Hey, > > i have a table called users which has my users in it, each have a uid > field. > I also have a stories table which has stories in it each with a sid field > for each story but also a uid field so i know which user the story > belongs > to. > > i want to write a quer

Re: optimize my.cnf

2009-09-03 Thread Darren Cassar
Hi Christos, Performance optimization is very subjective, and if you are experiencing low performance it can be a million different things. The description you provided didn't mention any of your current my.cnf settings, nor did it mention what kind of tables your database contains, size of data,

Re: need help with relational tables/fields

2009-09-03 Thread Wolfgang Schaefer
AndrewJames schrieb: > Hey, > > i have a table called users which has my users in it, each have a uid > field. > I also have a stories table which has stories in it each with a sid field > for each story but also a uid field so i know which user the story > belongs > to. > > i want to write a quer

optimize my.cnf

2009-09-03 Thread Christos Pelekis
Hi, can you please send me some optimization examples for my.cnf ? I use mysql 5.1.37 The server run just 2 very busy forums. It is quad core cpu and 8 giga ram so we have lot of run (run debian) Can you please give me some examples? Thanks -- MySQL General Mailing List For list archives: http:/

need help with relational tables/fields

2009-09-03 Thread AndrewJames
Hey, i have a table called users which has my users in it, each have a uid field. I also have a stories table which has stories in it each with a sid field for each story but also a uid field so i know which user the story belongs to. i want to write a query that will display the story depending