I want to use join in Django QuerySet, not RawQuerySet
records = MailBoxEmailViewLog.objects.filter(evl_id__in=RawSQL(
'''SELECT a.*, b.*
FROM AT_MailBoxEmailViewLogs a
INNER JOIN AT_MailBoxs b ON b.mail_box_id = a.evl_mail_box_id''',
[]
)).values()
return HttpResponse(records)
I run this but I get this error ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Only one expression can be specified in the select list when the subquery is not introduced with EXISTS. (116) (SQLExecDirectW)')