Your Question
I'm trying to link two tables together with a one to many relationship and I do not see documentation for linking two columns in the references. Both tables have two unique columns and can't be linked on just one.
The document you expected this should be explained
Expected answer
gorm:"foreignKey:customer_id,company_id;references:customer_id,company_id"
Comment From: comsma
so I tried it out the way I expected to assign my columns and get the following query from it
SELECT * FROM "oe_hdr" WHERE ("oe_hdr"."customer_id","oe_hdr"."company_id") IN ((100000,'MRS'))
It seems to generate a query alright but mssql doesn't like the fact that i'm passing two columns into the where clause. A valid query in mssql would be
SELECT *
FROM "oe_hdr"
WHERE ("oe_hdr"."customer_id") IN (100000) AND ("oe_hdr"."company_id") IN ('MRS')
Is there a way I can get gorm to generate the query in that format?
Comment From: Roldification
im having this trouble also in mssql. i hope this can be solved soon ^_^
Comment From: Roldification
Have you find solution for this?
Comment From: saeidee
Closing this issue since there is a feature request reported here https://github.com/go-gorm/gorm/issues/6441.