Home > Archive > MySQL ODBC Connector > January 2006 > i have one doubt









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author i have one doubt
Veerabhadrarao Narra

2006-01-28, 7:23 am


i have to write one query

Division Units Year
ameerpet 200 2004
ameerpet 300 2005
ameerpet 500 2006

From these values i want to retreive as like this

Division Units Year
ameerpet 200 2004
ameerpet 100 2005
ameerpet 200 2006
Means difference of the Units values by year can u give me this query.

--
veerabhadrarao narra,


--
veerabhadrarao narra,
+91-988-556-5556
Database Administrator,
I-ONE TECH LABS Pvt Ltd.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Gleb Paharenko

2006-01-28, 7:23 am

Hello.

set @s:=0;

select Division, Units, Year from (select v1.Division, v1.Units-@s as
Units, v1.Year, @s:=v1.Units from veer v1) as v2;



Veerabhadrarao Narra wrote:
> i have to write one query
>
> Division Units Year
> ameerpet 200 2004
> ameerpet 300 2005
> ameerpet 500 2006
>
> From these values i want to retreive as like this
>
> Division Units Year
> ameerpet 200 2004
> ameerpet 100 2005
> ameerpet 200 2006
> Means difference of the Units values by year can u give me this query.
>



--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko@stripped
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Veerabhadrarao Narra

2006-01-28, 7:23 am


Hi Gleb Paharenko,
ThanQ for assistance

--
veerabhadrarao narra,
+91-988-556-5556
I-ONE TECH LABS Pvt Ltd.
HYDERABAD, INDIA


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com