select case when name is null then 0 else 5 end + case when address is null then 0 else 6 end  + case when tel is null then 0 else 2 end  + case when note is null then 0 else 1 end from 表A

解决方案 »

  1.   

    是把B 表做成数据字典的形式的~我主要是要有个字段来存放统计出来的数字进行排序的,
    我现在自己已经做过一个算法,但效率太低,我把值算出来,在放进一个临时数组,再排序后输出,这样的运行效率很慢,如果大家有什么办法可以把算法写在服务器端我也欢迎。
    太阳黑子,能不能说明白点,这是字段名和记录之间,我找不到他们的联系。
    我最后要输出的形式是id   name   point
                        1     a      14
                         2     aa      8
                         3     aa       7
    忘记说了b表里的point 可以变换的,所以照黑子的说法不行