Hi All,
I have a relation based on a intermidate table. The relation fetches records which may have contain some same records multiple times. I would like to show a single record for each multiple records.
How can I do that in Servoy?
Thanks,
// Get all distinct PK's from the products table that are linked to the customer
var _sQuery = "SELECT DISTINCT products.pkColumn \
FROM products JOIN customerProduct ON products.pkColumn = customerProduct.fkColumn \
WHERE customerProduct.fkCustomerColumn=?";
// Now load the distict product PK's using the controller.
controller.loadRecords(_sQuery, [_nCustomerID]);
// Get all distinct PK's from the products table that are linked to the customer
var _sQuery = "SELECT DISTINCT products.pkColumn \
FROM products JOIN customerProduct ON products.pkColumn = customerProduct.fkColumn \
WHERE customerProduct.fkCustomerColumn=? AND customerProduct.launchDate<=?";
// Now load the distict product PK's using the controller.
controller.loadRecords(_sQuery, [_nCustomerID, _dProductLaunchDate]);
Infop wrote:Does this work for a datetime field?
Infop wrote:
- Code: Select all
// Get all distinct PK's from the products table that are linked to the customer
var _sQuery = "SELECT DISTINCT products.pkColumn \
FROM products JOIN customerProduct ON products.pkColumn = customerProduct.fkColumn \
WHERE customerProduct.fkCustomerColumn=? AND customerProduct.launchDate<=?";
// Now load the distict product PK's using the controller.
controller.loadRecords(_sQuery, [_nCustomerID, _dProductLaunchDate]);
The above code snippet shows the same. But, It is not working. The field, _dProductLaunchDate is a DateTime Variable.
Users browsing this forum: No registered users and 35 guests