I have three tables that i would like to join up together.
Domain table
-domainid - Primary key
DomainRegion table
-domainid - Don't have a Primary Key or Foreign Key
-dombegin
-domend
DynDomrun table
-ddid - Primary Key
-confid1
-confid2
"domain.domainid", "domainregion.domainid" and "dyndomrun.ddid" have the same type of data types, "character varying".
Now, the problem is that "domain.domainid" and "domainregion.domainid" has two extra characters in it that i can't seem to do a join with "dyndomrun.ddid".
However, "domainid" is related to "ddid", just that "domainregion.domainid" is not assigned a primary key or a foreign key and i need some fields from that table to join up with the others.
In the end, I need to have a single, full table listing the "dyndomrun.ddid, domainregion.dombegin, domainregion.domend, dyndomrun.confid1, dyndomrun.confid2".
I have tried using where ("domain.domainid",8)=left("dyndomrun.ddid",8)
, it gave me an error stating
ERROR: function left(character varying, integer) does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
I have tried using joins, and other sql statements and they all don't seem to work.
Any ideas as to how to solve this problem?
Thank you.