I’m trying to run a query on an Access DB, I’m used to SQL queries but this doesn’t seem to be working the same way. Here’s my query:
OleDbCommand command = new OleDbCommand();
command.Connection = connect;
command.CommandText = "SELECT RecordID, TimeStamp, EmployeeName, AreaDescription FROM LoginRecords r, Employees e, Areas a WHERE((e.EmployeeID = r.EmployeeID) && (a.AreaID =r.AreaID) && (TimeStamp > startDate AND < endDate)) ORDER BY TimeStamp;"
I can’t seem to get this to run but technically from a SQL standpoint this should be a good query. The tables are LoginRecords, Employees, Areas. I can load the tables if that would be helpful. I appreciate any feedback as to why this won’t work in Access. And startDate and endDate are variables from user input boxes.
Try this one,
This is
SQL-92Use
SQL-92format ratherSQL-89format becauseSQL-89(aside from old style) is prone to goingCROSS JOINif not handled correctly.and this is
SQL-89MSACCESS: INNER JOIN, OUTER JOIN (LEFT and RIGHT)