Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-14 Thread KLEIN Stéphane

2007/6/13, Ricardas S [EMAIL PROTECTED]:

ops again you probably needed just
select greatest(col1,col2,col3) from t order by 1


Thanks, it's work very well.

best regards

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread KLEIN Stéphane

Hi,

I would like do something like :

SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3);

I know this syntax is wrong but I would like get a solution to this stuff.

Thanks for your help.
Stephane

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S

Have you tried
MAX((col1*(MAX_VALUE_OF_COL1+1)+col2)*(MAX_VALUE_OF_COL2+1)+col3)

- Original Message - 
From: KLEIN Stéphane [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Wednesday, June 13, 2007 09:30
Subject: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable 
ORDER BY MAX(col1, col2, col3); ?



Hi,

I would like do something like :

SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3);

I know this syntax is wrong but I would like get a solution to this stuff.

Thanks for your help.
Stephane

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S

Ops, small mistake, shoud be

MAX((col1*(MAX_VALUE_OF_COL2+1)+col2)*(MAX_VALUE_OF_COL3+1)+col3)


- Original Message - 
From: Ricardas S [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Wednesday, June 13, 2007 09:36
Subject: Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM 
mytable ORDER BY MAX(col1, col2, col3); ?



Have you tried
MAX((col1*(MAX_VALUE_OF_COL1+1)+col2)*(MAX_VALUE_OF_COL2+1)+col3)

- Original Message - 
From: KLEIN Stéphane [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Wednesday, June 13, 2007 09:30
Subject: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable 
ORDER BY MAX(col1, col2, col3); ?



Hi,

I would like do something like :

SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3);

I know this syntax is wrong but I would like get a solution to this stuff.

Thanks for your help.
Stephane

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread KLEIN Stéphane

2007/6/13, Ricardas S [EMAIL PROTECTED]:

Ops, small mistake, shoud be

MAX((col1*(MAX_VALUE_OF_COL2+1)+col2)*(MAX_VALUE_OF_COL3+1)+col3)



Sorry, my question is ashamed.

Example, I've this row :

Col1 | Col2 | Col3
1  |   5   |   8
6  |   2   |   4
12|   13   |  6

After my query, I would like this :

Max_value_col
6
8
13

Well, I would like MAX value of cols of one row, not on all the column.

I don't know if my explication it more clear.

Stephane

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S

select greatest(col1,col2,col3) from
(select max(col1) as col1 from t) a,
(select max(col2) as col2 from t) b,
(select max(col3) as col3 from t) c

- Original Message - 
From: KLEIN Stéphane [EMAIL PROTECTED]

To: Ricardas S [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Wednesday, June 13, 2007 10:00
Subject: Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM 
mytable ORDER BY MAX(col1, col2, col3); ?



2007/6/13, Ricardas S [EMAIL PROTECTED]:

Ops, small mistake, shoud be

MAX((col1*(MAX_VALUE_OF_COL2+1)+col2)*(MAX_VALUE_OF_COL3+1)+col3)



Sorry, my question is ashamed.

Example, I've this row :

Col1 | Col2 | Col3
1  |   5   |   8
6  |   2   |   4
12|   13   |  6

After my query, I would like this :

Max_value_col
6
8
13

Well, I would like MAX value of cols of one row, not on all the column.

I don't know if my explication it more clear.

Stephane

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM mytable ORDER BY MAX(col1, col2, col3); ?

2007-06-13 Thread Ricardas S

ops again you probably needed just
select greatest(col1,col2,col3) from t order by 1

- Original Message - 
From: Ricardas S [EMAIL PROTECTED]

To: KLEIN Stéphane [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Wednesday, June 13, 2007 11:02
Subject: Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM 
mytable ORDER BY MAX(col1, col2, col3); ?



select greatest(col1,col2,col3) from
(select max(col1) as col1 from t) a,
(select max(col2) as col2 from t) b,
(select max(col3) as col3 from t) c

- Original Message - 
From: KLEIN Stéphane [EMAIL PROTECTED]

To: Ricardas S [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Wednesday, June 13, 2007 10:00
Subject: Re: How can I do something like this SELECT MAX(col1, col2, col3) FROM 
mytable ORDER BY MAX(col1, col2, col3); ?



2007/6/13, Ricardas S [EMAIL PROTECTED]:

Ops, small mistake, shoud be

MAX((col1*(MAX_VALUE_OF_COL2+1)+col2)*(MAX_VALUE_OF_COL3+1)+col3)



Sorry, my question is ashamed.

Example, I've this row :

Col1 | Col2 | Col3
1  |   5   |   8
6  |   2   |   4
12|   13   |  6

After my query, I would like this :

Max_value_col
6
8
13

Well, I would like MAX value of cols of one row, not on all the column.

I don't know if my explication it more clear.

Stephane

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Can I do this in one select sql?

2003-10-24 Thread taþhan
Hi everybody;

  I have a table like this;

|| NAME || IF_PURCHASED || COUNT  ||
---  
   tom true5
   tom false   7
   tom false   3
   sam true3
   sam true4
   sam false   2
   ben true1


i want to a select querry that can do this;

|| NAME  || TRUE_TOTAL_COUNT || FALSE_TOTAL_COUNT ||
 
   tom  5   10
   sam  7   2
   ben  1   0


I did this with 2 temporary  tables. one of selects  
true total count , other selects false total counts
then I JOINed them with UNION

Can I do this in one select sql?


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Can I do this in one select sql?

2003-10-24 Thread taþhan
Hi everybody;

  I have a table like this;

|| NAME || IF_PURCHASED || COUNT  ||
---  
   tom true5
   tom false   7
   tom false   3
   sam true3
   sam true4
   sam false   2
   ben true1


i want to a select querry that can do this;

|| NAME  || TRUE_TOTAL_COUNT || FALSE_TOTAL_COUNT ||
 
   tom  5   10
   sam  7   2
   ben  1   


I did this with 2 temporary  tables. one of selects  
true total count , other selects false total counts
then I JOINed them with UNION

Can I do this in one select sql?


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Can I do this in one select sql?

2003-10-24 Thread Parackov Eva, Ing
this should work:

select NAME, sum(if(IF_PURCHASED='true',COUNT,0)),
sum(if(IF_PURCHASED='false', COUNT,0)) from TABLENAME group by NAME;

eva


-Original Message-
From: cengiz tahan [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2003 9:29 AM
To: [EMAIL PROTECTED]
Subject: Can I do this in one select sql?


Hi everybody;

  I have a table like this;

|| NAME || IF_PURCHASED || COUNT  ||
---  
   tom true5
   tom false   7
   tom false   3
   sam true3
   sam true4
   sam false   2
   ben true1


i want to a select querry that can do this;

|| NAME  || TRUE_TOTAL_COUNT || FALSE_TOTAL_COUNT ||
 
   tom  5   10
   sam  7   2
   ben  1   


I did this with 2 temporary  tables. one of selects  
true total count , other selects false total counts
then I JOINed them with UNION

Can I do this in one select sql?


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Can I do this in a SELECT

2001-01-25 Thread Jason Terry

I have a need for a SELECT query...

I don't really want any of the data from the select...
Rather I need the size of the data

basically I need

SELECT sum(length(*)) FROM MyDB WHERE MyDB.Something LIKE 'this%'


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Can I do this in a SELECT

2001-01-25 Thread Cal Evans

no.

You can do:
SELECT sum(length(Something)) FROM MyDB WHERE MyDB.Something LIKE 'this%'

But you will have to specify that for each field you want...then add them
all up to get the length.


Cal
http://www.calevans.com


-Original Message-
From: Jason Terry [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 2:55 PM
To: [EMAIL PROTECTED]
Subject: Can I do this in a SELECT


I have a need for a SELECT query...

I don't really want any of the data from the select...
Rather I need the size of the data

basically I need

SELECT sum(length(*)) FROM MyDB WHERE MyDB.Something LIKE 'this%'


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php