This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I have two tables: Table Item int Id Primary Key int ItemTypeId nullable int EnclosureTypeId nullable string Label Table ItemType int Id Primary Key string Description How can I achieve the following query using Query object? Select T1.* from Item T1 Left Outer Join ItemType T2 On T2.Id=T1.ItemTypeId Or T2.Id=T1.ItemTypeId Where T2.description like '%PDU%' Ta - Imtiaz |
|
|
Unfortunately you wont be able to specify the join conditions with an OR. You can define a join with multiple criteria by using the appropriate overload for Join.Outer() but when dealing with multiple conditions we only AND those conditions. So you can either handle this situation by using the RawSql query property if you are using LightSpeed 5 where you can specify a literal SQL statement as above though bear in mind that you need to cater for any pluralization etc yourself in doing so, or alternatively by using a stored procedure.
|
|
|
Thanks Jeremy,
I would use Stored Procedures, but the result of my SQL statement is a Projection (i.e combination of columns from more than one tables) - and like I have mentioned previously in another post - ProcedureQuery doesn't let you Project |
|
|
Yes I can have a look into adding in this support - Ill update the thread once I have had a chance to investigate this :)
|
|