You have chosen to sponsor your bid up to a maximum amount of .
Hi, I need someone to optimize below SQL Query. This is run against a large database. The cross join hurts so do the CHARINDEX AND CONVERT.
SELECT * FROM bank_import AS A4
SELECT bank_import.ID AS ImportID, bank_import.Motif, substring(bank_import.Motif, 1, 1) As Location, bank_import.IsArchived AS BankArchived,
students_enroll.ID AS EnrollID, students_enroll.Language, students_enroll.ClasseID, students_enroll.Tariff, students.FirstName,
students.LastName, students.Address, students.PostCode, students.Locality, students.ID AS StudentID
INNER JOIN students_enroll ON students.ID = students_enroll.StudentID
CROSS JOIN bank_import
WHERE (((CHARINDEX(CONVERT (VARCHAR, students_enroll.StudentID),bank_import.Motif) > 0))
AND ((CHARINDEX(CONVERT (VARCHAR, students_enroll.ID),bank_import.Motif) > 0)) OR ((CHARINDEX(CONVERT (VARCHAR, students_enroll.OldID), bank_import.Motif) > 0)))
AND bank_import.IsArchived=0 AND (students_enroll.CycleID=19 OR students_enroll.CycleID=18)
As A5 ON A4.ID = A5.ImportID WHERE A4.MatchFound=0 AND A4.DateReleve='2014-01-29'