Hi George,

An unconfirmed use per your query question:

SELECT * FROM
(
  SELECT UPDATE_PROCEDURE()
) AS `updateProcedure`,
(
SELECT * FROM theTablename
) AS theTable
WHERE theTable.`LAST_UPDATE` > updateProcedure.`lastUpdateDate` ;


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of George Gallen
Sent: Friday, 20 July 2012 1:56 AM
To: U2 Users
Subject: [U2] MySQL query qestion....

This is specific to MySQL, but could apply to any SQL DB.

Is there a way to put the results of one query to be used by another, without 
having that second query run on each Iteration of the sub query?

Example:

SELECT * FROM TABLE WHERE LAST_UPDATE > (SELECT UPDATE_PROCEDURE());

The function UPDATE_PROCEDURE() returns a timestamp, and then updates itself 
with a new timestamp.

My workaround is:

SELECT * FROM TABLE WHERE LAST_UPDATE > (SELECT GET_PROCEDURE()); SELECT 
UPDATE_PROCEDURE();

Here the GET_PROCEDURE() only retrieves a value, and doesn't update it.

BUT...if there were half a million records in the TABLE, I'd prefer not to run 
the GET procedure half a million times
   To retrieve the same result which could add significant processing time 
(this would be run for each of the tables
   I'm mirroring on UV from MySQL .

George


_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
--
Message  protected by DealerGuard: e-mail anti-virus, anti-spam and content 
filtering.
http://www.pentanasolutions.com

Click here to report this message as spam:
https://login.mailguard.com.au/report/1FaOdyY7h0/4FA8oy9gy44s1FA732Klkr/0


This email and any attachments to it are confidential.
You must not use, disclose or act on the email if you are not the intended
recipient.  Liability limited by a scheme approved under Professional
Standards Legislation.
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to