запрос вот такой:
XLODBC
1
DRIVER={PostgreSQL Unicode(x64)};DATABASE=set;SERVER=localhost;PORT=5432;UID=postgres;PWD=Po324st324gr324es;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;UnknownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=8190;Debug=0;CommLog=0;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;ExtraSysTablePrefixes=dd_;LFConversion=1;UpdatableCursors=1;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrepare=1;LowerCaseIdentifier=0;GssAuthUseGSS=0;XaOpt=1
SELECT DISTINCT un_cg_product.name, un_cg_product.markingofthegood, un_cg_sale_restrictions.product_marking, un_cg_price.shop, un_cg_price.begindate, un_cg_price.enddate, un_cg_price.price, un_cg_max_discount_percent_restrictions.value FROM public.un_cg_max_discount_percent_restrictions un_cg_max_discount_percent_restrictions, public.un_cg_price un_cg_price, public.un_cg_product un_cg_product, public.un_cg_sale_restrictions un_cg_sale_restrictions WHERE un_cg_price.product_marking = un_cg_product.markingofthegood AND un_cg_product.markingofthegood = un_cg_sale_restrictions.product_marking AND un_cg_sale_restrictions.code = un_cg_max_discount_percent_restrictions.code ORDER BY un_cg_product.markingofthegood
name markingofthegood product_marking shop begindate enddate price value