I am dealing with two tables: "dyndomrun.ddid" = with a Primary key and "domainregion.domainid" = without any primary key nor foreign key.
"dyndomrun.ddid" definition is "character varying" and has 8 characters, whereas "domainregion.domainid" definition is also "character varying" but has 10 characters.
Problem : There are some fields in domainregion table that needs to be joined together with the primary key in dyndomrun table. I can't seem to do this using a simple JOIN statement such as below:
SELECT domainregion.domainid, domainregion.dombegin, domainregion.domend, dyndomrun.ddid
FROM domainregion, dyndomrun
WHERE domainregion.domainid = dyndomrun.ddid
ORDER BY domainregion.domainid, dyndomrun.ddid, domainregion.dombegin, domainregion.domend;
I have tried JOINS, INNER JOINS, LIKE, none of them seems to work. The database that I am dealing with is purely SQL based stored using PostgreSQL.
Is there a method that i can use in which it selects the domainregion.domainid based on the length of the character and matching it dyndomrun.ddid?
Please advise.