on ‎2018 Oct 13 3:19 AM
I'm trying to get the enumeration values related products but with a left join to fetch data even when a particular enum value does not have a value, without success, my query look like:
SELECT enumValue.p_name
FROM
{
MyType! as myType
}
LEFT join
Enumerationvalueslp enumLineValue ON {myType.enumField} = enumValue.itempk
WHERE
{myType.enumField} = enumValue.itempk
But I get "no composed type with code myType.enumField Any suggest would be appreciated.
Request clarification before answering.
I've already solved doing the following:
SELECT evl.p_name
FROM {
MyType! as myType
}
LEFT JOIN enumerationvalueslp evl
ON P_MYENUMFIELD = evl.itemPK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Enumerationvalueslp is a Database Table, not a Type. When you create a FlexibleSearch query, you should use Type names, not DB Table names (or column names). You also cannot mix Type names and DB Table names.
This is an example with a Product type and an ArticleApprovalStatus enumeration, to get the list of Products, joined with Approval Status:
SELECT * FROM {Product AS p LEFT JOIN ArticleApprovalStatus AS s ON {p.approvalStatus}={s.pk}}
If you wanted to get the list Products that are approved, you could add a WHERE clause:
SELECT * FROM {Product AS p LEFT JOIN ArticleApprovalStatus AS s ON {p.approvalStatus}={s.pk}} WHERE {s.code} = 'approved'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.