Re: simple query

2006-03-13 Thread Diego Ignacio Wald

Hope this helps:

select min(ctime), max(ctime) from tbl_a where ctime != -00-00 
00:00:00


Best regards,

Diego

- Original Message - 
From: Xiaobo Chen [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Monday, March 13, 2006 11:17 AM
Subject: simple query



Hi, all

I have a table which has a column with time. It's format is like
-00-00 00:00:00 (default value). I want to get the minimum and
maximum values for this cloumn. Obviously, -00-00 00:00:00 isn't the
minimum value I want.

What I did for the minimum time, suppose the column name is ctime, the
table name is tbl_a:

select ctime form tbl_a where ctime-00-00 00:00:00 order by ctime
limit 1;

Using this query, I am able to get the minimum time value. But what is
the query for max time value? I guess it's something about reverseing
the order by, but I couldn't find it.

Could anyone please give me a hand?

Thanks a lot.

Xiaobo


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



__ InformaciĆ³n de NOD32 1.1440 (20060312) __

Este mensaje ha sido analizado con  NOD32 antivirus system
http://www.nod32.com








___ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




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



Re: INSERT SELECT Problem

2005-11-23 Thread Diego Ignacio Wald

Hi Shaun,

You could use the following statement:

INSERT INTO Allocations(Project_ID, User_ID, YES_COLUMN)
SELECT  P.Project_ID, U.User_ID, 'Yes'
FROM Users U, Projects P, Clients C
WHERE P.Client_ID = C.Client_ID
AND U.Client_ID = C.Client_ID
AND Project_ID =.$project_id)

Please replace YES_COLUMN with the column name that stores the 'Yes' values.

Best regards,

Diego Wald

- Original Message - 
From: Shaun [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Wednesday, November 23, 2005 11:21 AM
Subject: INSERT SELECT Problem



Hi,

The following query worked fine:

INSERT INTO Allocations(Project_ID, User_ID)
SELECT  P.Project_ID, U.User_ID
FROM Users U, Projects P, Clients C
WHERE P.Client_ID = C.Client_ID
AND U.Client_ID = C.Client_ID
AND Project_ID =.$project_id)

However I want to add a column to the INSERT part of the query and the 
value to be inserted must always be 'Yes'. Is there a way to do this with 
just with one query?


Thanks for your help.


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



__ InformaciĆ³n de NOD32 1.1298 (20051123) __

Este mensaje ha sido analizado con  NOD32 antivirus system
http://www.nod32.com









___ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




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