是否可以在mysql中编写此算法?

时间:2016-05-10 04:48:18

标签: php mysql sql

我有这个算法

  • 输入:转移的交易表T
  • 输出:表格FP
  • 步骤:
    • 对于表格中第一个相同tid的项目,T 0插入表格FP
    • 对于表格中包含其他相同tid的项目T 0 insertFP(items);
insertFP (items) 
count := 1; 
curpath := null;
if FP has an item f = i1 (the first item in the items) and f. path = null 
   for each item ik in the items 
       insert ik into the table FP;
       curpath += ik;
else
   for each item ik in the items 
       if FP has not an item f = ik 
           insert ik into the table FP; 
       else
           if f. path != ik. path 
              insert ik into the table FP; 
            else
               curcount = ik. count + 1; 
               update the table FP; 
        curpath += ik;

我已经在表T中获得了第一个相同的tid,并且还得到了其他相同的tid,但我还不知道如何用php语言处理它。 所以问题是,是否有可能在mysql中编写这个算法?

0 个答案:

没有答案
相关问题