Hey,
I want to convert the following SQL Query to a SubSonic Query.
SELECT [dbo].[tbl_Agency].[ParentCompanyID]
FROM [dbo].[tbl_Agency]
WHERE REPLACE(PhoneNumber, ' ', '') LIKE REPLACE('%9481 1111%', ' ', '')
I thought I would do it like below, but I just can't get it to produce valid SQL.
//SubSonic
string agencyPhoneNumber = "9481 1111";
SubSonic.SqlQuery subQueryagencyPhoneNumber = new SubSonic.Select(Agency.ParentCompanyIDColumn.ColumnName);
subQueryagencyPhoneNumber.From(Agency.Schema.TableName);
//WHERE
subQueryagencyPhoneNumber.Where("REPLACE(" + Agency.PhoneNumberColumn.ColumnName + ", ' ', '')").Like("%" + agencyPhoneNumber + "%");
Does anyone out there know how to fix this - I'm using SubSonic 2.2.
I feel like I'm taking crazy pills here - this should be straightforward, right?
Cheers,
JohnBob