sql >> データベース >  >> RDS >> PostgreSQL

2つのテーブルから3番目のテーブルを作成します

    結果を次のようにtable2と左結合します:

    select t2."Source", to_char(coalesce(t1."The Ratio",0),'990%') "The Ratio"
    from table2 t2 left outer join
      (select "Source", 100 * count(*) / sum(count(*)) over ()  "The Ratio"
       from TableA 
       group by "Source") t1
    on t1."Source" = t2."Source";
    


    1. JavaInstantをMySQLデータベースに保存する方法

    2. SQLServerのシノニムの概要

    3. エラー-メソッド「X.set_DbConnection(System.Data.Common.DbConnection)」によるメソッド「Y.get_Settings()」へのアクセスに失敗しました

    4. SQLite JSON_TREE()