User Profile

Collapse

Profile Sidebar

Collapse
h2odev
h2odev
Last Activity: Oct 27 '14, 09:05 PM
Joined: Oct 10 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hi Luuk,

    Your query works correctly.

    Also I like the idea how you include the WHERE clause and `mytable`.`id` inside subquery, very nice.


    I will post here (Just for community wiki) another solution, using User Defined Variables inside User Defined Function to "return" multiple variables.


    Code:
    DELIMITER $$
    
    CREATE DEFINER=`dbuser`@`localhost` 
    FUNCTION `getchildren`(
    ...
    See more | Go to post

    Leave a comment:


  • Hi Luuk,
    Thanks for reply and your time.

    In fact this doesn't resolve my problem. I want to update multiple columns of table `mytable` (children, size) using COUNT() and SUM() on same table `mytable`. Right now I'm using MySQL stored function but i know is possible to update the table without calling functions for each column, but just a JOIN (Equal to virtual/temporary table logic).

    Maybe I'm wrong, can you please...
    See more | Go to post

    Leave a comment:


  • h2odev
    started a topic Mysql subquery COUNT in same Table returns NULL

    Mysql subquery COUNT in same Table returns NULL

    Hi,
    I have this MySQL table and I want to update multiple columns ( children, size) using COUNT() and SUM() on same table.

    mytable

    Code:
    id  parentid  name      userid   path    children   privatesize    size
    =======================================================================
    1   0         Test-1    1        NULL      5        20             125
    2   0         Test-2    1        NULL      0        15
    ...
    See more | Go to post
No activity results to display
Show More
Working...