postgresql - Running a postgres query between two databases with conditions -
I have two postgrass databases on the same server.
I need to remove the records from a database and put them in another. This is my working query.
in fact, this pulls tblInvInfo dbESM to record and puts them in the same table dbESMTemp < / P>
Now, the requirement ... tblInvMaster is the main description of an invoice (and includes the date), while There is a description of the tblInvInfo item.
I just need to get the record tblInvInfo the specific circumstances in that tblInvMaster . I think this is done through a simple internal scheme query. So it is that I've tried to do:
"select tblInvInfo" to put "iiInvNum", "iiItemCode", "iiUnitMeasure", "iiUnitQuantity", "iiPrice", the dblink "iiUnits" ( 'dbname = dbESM', 'select' iiInvNum "," iiItemCode "," iiUnitMeasure "," iiUnitQuantity "," iiPrice ", please select" iiUnits "(" tblInvInfo ". * from (" select the tblInvMaster "* where" invDate "between \" 2014-08-01 \ "and \" 2014-10-17 \ ") includes inner invmaster" invInvNum "on" tblInvInfo "=" iiInvNum ") filteredinvinfo ') having as invinfo ( "iiInvNum" varchar, "iiItemCode" varchar, "iiItemName" varchar, "iiUnitMeasure" varchar, "iiUnitQuantity" numeric, "iiPrice" numeric, "iiUnits" numeric);
Up For queries containing, I get the following error:
Error: syntax error "2014" at or near "line 7" Where \ '2014-08-01 between "InvDate" \ 'and \' 2014-10-17 \ ') ... ^
My union are three areas of doubt about right but my query:
- Is it true, the way coding is given?
- Is the back-slash technique correct in the query?
- I'm not sure this dblink function.
Any help to get this solution is really appreciated.
Comments
Post a Comment