ZSQL Method question
Is it possible to run a SELECT query (just one - as per doc) in a ZSQL Method and then use the results of that to run a INSERT query in the "same" ZSQL method... If yes how do I access the result of the select?? I am just trying to get around the lack of sub-queries in MySQL. and dont really want to set up a ZSQL method for each query/insert and then use another method to bring them all together. However if there is another way to do the whole thing.......I would be immensely grateful for any pointers in that direction. TIA AM -- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
This is a SQL-specific thing.. nothing to do with zope. I think you can do this with MySQL with the insert/select combination. INSERT INTO TABLE (columns,,,) SELECT columns,,, FROM .... The two column lists have to match. check the mysql manual for the exact syntax. On Tue, Jun 11, 2002 at 03:00:40AM -0700, Aseem Mohanty wrote:
Is it possible to run a SELECT query (just one - as per doc) in a ZSQL Method and then use the results of that to run a INSERT query in the "same" ZSQL method... If yes how do I access the result of the select??
I am just trying to get around the lack of sub-queries in MySQL. and dont really want to set up a ZSQL method for each query/insert and then use another method to bring them all together.
However if there is another way to do the whole thing.......I would be immensely grateful for any pointers in that direction.
TIA AM
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi, Thanks for the answer. The problem with the INSERT...SELECT option is that it allows to insert rows(specific cols or not) from another table to the current one. What I wanted to do by using some (if it exists) form of ZSQL was : insert into tbl (col1,col2.....) values (select col1 from tbl 1 where ...., val2, val3.....) so as of right now what I would have to do is to run a select query, bury the result in a request send it to another query that then runs a insert into..... If it were only a few inserts and stuff I woudlnt mind but when the number of different tbls I have to use increases it slowly becomes nightmarish to keep track of everything. Thanks anyway. AM Kevin Lewandowski wrote:
This is a SQL-specific thing.. nothing to do with zope.
I think you can do this with MySQL with the insert/select combination.
INSERT INTO TABLE (columns,,,) SELECT columns,,, FROM ....
The two column lists have to match. check the mysql manual for the exact syntax.
On Tue, Jun 11, 2002 at 03:00:40AM -0700, Aseem Mohanty wrote:
Is it possible to run a SELECT query (just one - as per doc) in a ZSQL Method and then use the results of that to run a INSERT query in the "same" ZSQL method... If yes how do I access the result of the select??
I am just trying to get around the lack of sub-queries in MySQL. and dont really want to set up a ZSQL method for each query/insert and then use another method to bring them all together.
However if there is another way to do the whole thing.......I would be immensely grateful for any pointers in that direction.
TIA AM
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
participants (2)
-
Aseem Mohanty -
Kevin Lewandowski