Hi,
I am struggling with joining and filtering data in LLBL Gen
Where can i find some examples?
Assume I have four tables, order, orderdetails, customer and category.
Order (Id, CustomerId, Number, Date)
OrderDetail (Id, OrderId, Amount, CategoryId)
Customer (Id, Name)
Category(Id, Name)
I want to have the orders after a specific date with a specific category for a specific customer.
My query will be something like below.
SELECT o.Id, o.Number, o.Date, c.Name, cat.Name, od.Amount
FROM Order o
INNER JOIN OrderDetails od ON od.OrderId = o.Id
INNER JOIN Category cat ON cat.Id = od.CategoryId
INNER JOIN Customer c ON c.Id = o.CustomerId
WHERE o.Date > GETDATE()
AND od.CategoryId = 2
AND o.CustomerId = 34
Or if my query is simpler will that change the way we need to ask LLBLGen?
SELECT o.Id, o.Number, o.Date
FROM Order o
INNER JOIN OrderDetails od ON od.OrderId = o.Id
WHERE o.Date > GETDATE()
AND od.CategoryId = 2
AND o.CustomerId = 34
Can you please shine some light on this?
Regards,
John