Re: SUM in WHERE

2006-09-25 Thread Peter Brawley
| >> >> | 32.43 | 230.43305176 | >> >> | 3 | 233.43305176 | >> >> +-+--+ >> >> 3 rows in set (0.00 sec) >> >> >> >> >> >> Good luck! >> >> >> >>

Re: SUM in WHERE

2006-09-25 Thread Ahmad Al-Twaijiry
Douglas Sims >> >> [EMAIL PROTECTED] >> >> >> >> >> >> >> >> >> >> >> >> On Sep 19, 2006, at 4:02 PM, Quentin Bennett wrote: >> >> >> >> > No, I don't think it is.

Re: SUM in WHERE

2006-09-24 Thread Douglas Sims
gt;> > 4 40 >> > 5 50 >> > >> > it would return >> > >> > 1 10 >> > 2 20 >> > 3 30 >> > 4 40 >> > >> > (sum total = 100) >> > >> > but if your table was >> > >

Re: SUM in WHERE

2006-09-24 Thread Ahmad Al-Twaijiry
2 20 >> > 3 30 >> > 4 40 >> > 5 50 >> > >> > it would return >> > >> > 1 10 >> > 2 20 >> > 3 30 >> > 4 40 >> > >> > (sum total = 100) >> > >> > but if yo

Re: SUM in WHERE

2006-09-24 Thread Douglas Sims
ves >> Virginia Tech Information Technology >> 1700 Pratt Drive >> Blacksburg, VA 24060 >> >> Email: [EMAIL PROTECTED] >> Phone: (540) 231-4396 >> >> -Original Message- >> From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] >> Sen

Re: SUM in WHERE

2006-09-24 Thread Ahmad Al-Twaijiry
doesn't work :( , tested with 4.1.21 On 21 Sep 2006 13:20:37 -, Felix Geerinckx <[EMAIL PROTECTED]> wrote: On 18/09/2006, "Ahmad Al-Twaijiry" wrote: > I want to run SQL query that will return to me the first records that > the SUM of Total field = 100 USE test; DROP TABLE IF EXISTS foo; CR

Re: SUM in WHERE

2006-09-24 Thread Ahmad Al-Twaijiry
t; > Using only SQL, your best bet would be a stored procedure, > otherwise its really application logic to select the rows one at a > time and keep a running total. > > HTH > > Quentin > > -Original Message----- > From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECT

Re: SUM in WHERE

2006-09-21 Thread Felix Geerinckx
On 18/09/2006, "Ahmad Al-Twaijiry" wrote: > I want to run SQL query that will return to me the first records that > the SUM of Total field = 100 USE test; DROP TABLE IF EXISTS foo; CREATE TABLE foo ( id INT UNSIGNED NOT NULL PRIMARY KEY, total INT NOT NULL); INSERT INTO foo VALUES (1, 20), (2,

Re: SUM in WHERE

2006-09-20 Thread Douglas Sims
ginal Message- From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] Sent: Wednesday, 20 September 2006 2:24 a.m. To: Price, Randall Cc: Edward Macnaghten; mysql@lists.mysql.com Subject: Re: SUM in WHERE Actually is this possible with simple SQL command in Mysql ? On 9/19/06, Price, Randall <[EMAIL

RE: SUM in WHERE

2006-09-19 Thread Quentin Bennett
--Original Message- From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] Sent: Wednesday, 20 September 2006 2:24 a.m. To: Price, Randall Cc: Edward Macnaghten; mysql@lists.mysql.com Subject: Re: SUM in WHERE Actually is this possible with simple SQL command in Mysql ? On 9/19/06, Price, Randall <[EM

Re: SUM in WHERE

2006-09-19 Thread Ahmad Al-Twaijiry
Information Technology 1700 Pratt Drive Blacksburg, VA 24060 Email: [EMAIL PROTECTED] Phone: (540) 231-4396 -Original Message- From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 19, 2006 10:06 AM To: Edward Macnaghten Cc: mysql@lists.mysql.com Subject: Re: SUM

RE: SUM in WHERE

2006-09-19 Thread Price, Randall
ginal Message- From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 19, 2006 10:06 AM To: Edward Macnaghten Cc: mysql@lists.mysql.com Subject: Re: SUM in WHERE I tried it also with 4.1.21-log and still didn't work ! On 9/19/06, Ahmad Al-Twaijiry <[EMAIL PROTECTED

Re: SUM in WHERE

2006-09-19 Thread Ahmad Al-Twaijiry
I tried it also with 4.1.21-log and still didn't work ! On 9/19/06, Ahmad Al-Twaijiry <[EMAIL PROTECTED]> wrote: I tried that before and it also doesn't work, is it because I'm using mysql version 4.1.19 ? On 9/19/06, Edward Macnaghten <[EMAIL PROTECTED]> wrote: > Ahmad Al-Twaijiry wrote: > > >

Re: SUM in WHERE

2006-09-19 Thread Ahmad Al-Twaijiry
I tried that before and it also doesn't work, is it because I'm using mysql version 4.1.19 ? On 9/19/06, Edward Macnaghten <[EMAIL PROTECTED]> wrote: Ahmad Al-Twaijiry wrote: > Hi everyone > > SELECT * FROM tbl_name WHERE SUM(Total)=100 ORDER BY ID > > SELECT ID FROM tbl_name GROUP BY ID HA

Re: SUM in WHERE

2006-09-18 Thread Edward Macnaghten
Ahmad Al-Twaijiry wrote: Hi everyone SELECT * FROM tbl_name WHERE SUM(Total)=100 ORDER BY ID SELECT ID FROM tbl_name GROUP BY ID HAVING SUM(Total)=100 ORDER BY ID -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[E

Re: SUM in WHERE

2006-09-18 Thread Ahmad Al-Twaijiry
--- > Von: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 18. September 2006 23:28 > An: mysql@lists.mysql.com > Betreff: SUM in WHERE > [...] > > I want to run SQL query that will return to me the first > records that the > SUM of Total field = 100 > &

AW: SUM in WHERE

2006-09-18 Thread André Hänsel
> -Ursprüngliche Nachricht- > Von: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 18. September 2006 23:28 > An: mysql@lists.mysql.com > Betreff: SUM in WHERE > [...] > > I want to run SQL query that will return to me the first > records th

SUM in WHERE

2006-09-18 Thread Ahmad Al-Twaijiry
Hi everyone I didn't find any maillist regarding SQL question so I'm posting my question in here. I have a table like this [ ID ][ Total ] [ 1 ][ 20 ] [ 2 ][ 30 ] [ 3 ][ 40 ] [ 4 ][ 10 ] [ 5 ][ 20 ] [ 6 ][ 20 ] I want to run SQL query that will return to me