Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我需要帮助将一个脚本从SQL server翻译成Postgresql来计算多列的优势比?_Sql_Postgresql - Fatal编程技术网

我需要帮助将一个脚本从SQL server翻译成Postgresql来计算多列的优势比?

我需要帮助将一个脚本从SQL server翻译成Postgresql来计算多列的优势比?,sql,postgresql,Sql,Postgresql,我需要帮助修改前一个问题中的代码 在Postgresql中包含两列。这就是我现在拥有的。我有语法错误 --Compute the odds ratios from the model SELECT a."column1", a."column2" a.uvs AS testuvs, b.uvs AS controluvs, CASE WHEN b.uvs > 0 THEN a.puvs / b.puvs ELSE NULL END AS odds

我需要帮助修改前一个问题中的代码 在Postgresql中包含两列。这就是我现在拥有的。我有语法错误

    --Compute the odds ratios from the model 
    SELECT a."column1", a."column2"
    a.uvs AS testuvs,
    b.uvs AS controluvs,
    CASE WHEN b.uvs > 0 THEN a.puvs / b.puvs ELSE NULL END AS odds
    INTO "bivariate_odds"
    FROM "control_group_probabilities" b
    INNER JOIN "test_group_probabilties" a ON 
    a.column1 = b.column1 and a.column2=b.column2
    WHERE a.uvs > 24 AND b.uvs > 24
    ORDER BY odds DESC
在SQL server中,我可以毫无困难地运行以下脚本:

    --compute the odds ratios 
    select a.column1, b.column2, a.totaluvs as totaltestuvs, a.uvs as 
    testuvs, b.totaluvs as totalcontroluvs, b.uvs as controluvs
    , odds= case when b.puvs>0.000001 then a.puvs/b.puvs else null end
    into bivariate_odds
    from test_group_probabilties a
    inner join control_group_probabilities b
    on a.column1=b.column1
    and a.column2=b.column2

SQL server代码是我想在Postgresql中表达的代码

使用
create table as
而不是
select into
,代码应该很好。具体地说,
create table bivariate_赔率as select…
我得到了这个错误:语法错误在或接近“.”第3行:a.uvs作为testuvs,您在第1行的末尾缺少了一个逗号。