File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -263,14 +263,32 @@ protected virtual SqlResult CompileDeleteQuery(Query query)
263
263
throw new InvalidOperationException ( "Invalid table expression" ) ;
264
264
}
265
265
266
+ var joins = CompileJoins ( ctx ) ;
267
+
266
268
var where = CompileWheres ( ctx ) ;
267
269
268
270
if ( ! string . IsNullOrEmpty ( where ) )
269
271
{
270
272
where = " " + where ;
271
273
}
272
274
273
- ctx . RawSql = $ "DELETE FROM { table } { where } ";
275
+ if ( string . IsNullOrEmpty ( joins ) )
276
+ {
277
+ ctx . RawSql = $ "DELETE FROM { table } { where } ";
278
+ }
279
+ else
280
+ {
281
+ // check if we have alias
282
+ if ( fromClause is FromClause && ! string . IsNullOrEmpty ( fromClause . Alias ) )
283
+ {
284
+ ctx . RawSql = $ "DELETE { Wrap ( fromClause . Alias ) } FROM { table } { joins } { where } ";
285
+ }
286
+ else
287
+ {
288
+ ctx . RawSql = $ "DELETE { table } FROM { table } { joins } { where } ";
289
+ }
290
+
291
+ }
274
292
275
293
return ctx ;
276
294
}
You can’t perform that action at this time.
0 commit comments