View Single Post
  #1 (permalink)  
Old 03-25-2008, 02:05 AM
orjan's Avatar   
orjan orjan is offline
Programmer
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 159
Credits: 187
Rep Power: 6
orjan will become famous soon enoughorjan will become famous soon enough
Question writing stored procedure in mysql

Hello there. In order to improve speed of my php code, I would like to rewrite it to an MySQL Stored Procedure, is there anyone who can help med with this? is it even possible to do?

what I want to do is this, written in some kind of pseudocode

Code:
for each post in table x
   select * from table y where y.id=x.yid
   if match not found
       insert into y
   else
       if x.value = y.value
           update y set y.date = now();
       else 
           update y set y.value = x.value
        endif
    endif
endfor
Reply With Quote

Sponsored Links