pgsql 详细信息所有ID Meta

details_IDs
select release.label_id, release.release_id, product.product_id, product.identifier, product.barcode, product.catalog_no, prodtrack.product_isrc, prodtrack.track_id, track.isrc from details_releases as release left join details_products as product on release.release_id = product.release_id left join details_product_tracks as prodtrack on product.product_id = prodtrack.product_id left join details_tracks as track on prodtrack.track_id = track.track_id;

pgsql 手上

on_hand
select stock.catalogno,cat.releaseartist, cat.releasetitle, cat.releasedate, stock_qty, onhand.order_total, (stock_qty-onhand.order_total) as on_hand, coalesce((stock_qty-onhand.order_total), stock_qty) as karsten from kdgstock as stock left join (select p.catalogno, sum(qty) as order_total from (select k.catalogno, k.distributor, k.entry_date, qty from kdglog as k inner join (select max(entry_date) as max_date, distributor, catalogno from kdglog group by distributor, catalogno) as m on m.max_date = k.entry_date and m.catalogno = k.catalogno and m.distributor = k.distributor where k.entry_type != 'SHIPMENT' and k.entry_type != 'ORDER' order by k.catalogno) as p group by catalogno) as onhand on stock.catalogno = onhand.catalogno inner join (select releaseartist, releasetitle, releasedate, catalogno from catalognew) as cat on stock.catalogno = cat.catalogno;

pgsql 列数

PostgreSQL表中的列数。

col_count
select count(*) from information_schema.columns where table_name='x';

pgsql PROC LOGISTICS

#SAS Logistic回归

proc-logistic-base.sas
PROC LOGISTIC DATA=SAS-data-set <options>; 
        MODEL variable <(variable_options)> = <effects> < / options>; 
RUN;
proc-logistics-example.sas
/*st107d04.sas*/
ods graphics on;
proc logistic data=STAT1.ameshousing3 alpha=0.05
              plots(only)=(effect oddsratio);
    model Bonus(event='1')=Basement_Area / clodds=pl;
    title 'LOGISTIC MODEL (1):Bonus=Basement_Area';
run;

pgsql 会计EMS导入和托管

accounting_ems
select 80440,5131,'31.06.2019','EMS0619 ' || label, 'EMS0619', (select code from accounting_codes where label like q.label) as code, ' ','EUR', 'EUR', 1, ' ', q.total_cost, ' ', ' ', 40, 'EMS0619', q.label  from (select label_host as label, (coalesce(import_cost,0) + hosting_cost)::money as total_cost from (select import_cost, (trackcount_host * 0.063) as hosting_cost, label_host from accounting_ems as a full join ( select label_import, (sum(trackcount_import) * 0.59) as import_cost from accounting_ems group by label_import) as b  on a.label_host = b.label_import) as t) as q;

pgsql 删除重复的行

delete_dupes
DELETE FROM dups a USING (
      SELECT MIN(ctid) as ctid, key
        FROM dups 
        GROUP BY key HAVING COUNT(*) > 1
      ) b
      WHERE a.key = b.key 
      AND a.ctid <> b.ctid

pgsql 出口ODS PDF

#SAS

export-ods-pdf.sas
ODS PDF FILE="filename.pdf" STYLE=style
                STARTPAGE=NO PDFTOC=n;
ODS PROCLABEL "label";

/* SAS code that produces output */

ODS PDF CLOSE;




/* Example */
ods pdf file="&outpath/wind.pdf" startpage=no style=journal pdftoc=1; 
ods noproctitle;

ods proclabel "Wind Statistics";
title "Wind Statistics by Basin";
proc means data=pg1.storm_final min mean median max maxdec=0;
    class BasinName;
    var MaxWindMPH;
run;

ods proclabel "Wind Distribution"; 
title "Distribution of Maximum Wind";
proc sgplot data=pg1.storm_final;
    histogram MaxWindMPH;
    density MaxWindMPH;
run;
title;

ods pdf close; 

pgsql ODS出口到RTF

#SAS

ods-export-rtf.sas
ODS RTF FILE="filename.rtf" STARTPAGE=NO;
/* SAS code that produces output */
ODS RTF CLOSE;

/* Example */
ODS RTF FILE="&outpath/ParkReport.rtf" style=Journal STARTPAGE=NO;
ods noproctitle;

title "US National Park Regional Usage Summary";

proc freq data=pg1.np_final;
    tables Region /nocum;
run;

proc means data=pg1.np_final mean median max nonobs maxdec=0;
    class Region;
    var DayVisits Campers;
run;

ods rtf style=SASDocPrinter;

title2 'Day Visits vs. Camping';
proc sgplot data=pg1.np_final;
    vbar  Region / response=DayVisits;
    vline Region / response=Campers ;
run;
title;

ods proctitle;
ODS RTF CLOSE;

pgsql ODS出口到POWERPOINT

#SAS

ods-export-pp.sas
ODS POWERPOINT FILE="filename.pptx" STYLE=style;
/* SAS code that produces output */
ODS POWERPOINT CLOSE;

pgsql 导出报告Excel ODS

export-excel-ods.sas
ODS EXCEL FILE="filename.xlsx" STYLE=style
        OPTIONS(SHEET_NAME='label');

/* SAS code that produces output */

ODS EXCEL CLOSE;

/* Example */

ods excel file="&outpath/wind.xlsx" style=sasdocprinter
          options(sheet_name='Wind Stats');
title "Wind Statistics by Basin";
ods noproctitle;
proc means data=pg1.storm_final min mean median max maxdec=0;
    class BasinName;
    var MaxWindMPH;
run;

ods excel options(sheet_name='Wind Distribution');
title "Distribution of Maximum Wind";
proc sgplot data=pg1.storm_final;
    histogram MaxWindMPH;
    density MaxWindMPH;
run;
title;
ods proctitle;
ods excel close;