Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL INNER JOIN ERROR

Status
Not open for further replies.

romerz

IS-IT--Management
Jul 19, 2006
29
GB
Code:
$sql = "SELECT Orders.john_text3, Orders.orderDate, Orders.orderId, Orders.john_tex10, Orders.total, TransactionEntryItems.returnDate";
#$sql.= "FROM ((Orders INNER JOIN Transactions on Orders.orderId = Transactions.orderId) INNER JOIN TransactionEntries ON Transactions.transactionId = TransactionEntries.transactionId) INNER JOIN TransactionEntryItems ON TransactionEntries.transactionEntryId = TransactionEntryItems.TransactionEntryId";
$sql.= "FROM ((Orders INNER JOIN Transactions ON Orders.orderId = Transactions.orderId) INNER JOIN TransactionEntries ON Transactions.transactionId = TransactionEntries.transactionId) INNER JOIN TransactionEntryItems ON TransactionEntries.transactionEntryId = TransactionEntryItems.transactionEntryId";


$sql.= "WHERE ( (Orders.orderStatusId >=3) AND (Orders.orderStatusId <=5) ) AND (Orders.john_text3 <> 'TDC') AND (Orders.john_text3 <> '')";

nevermind the perl bits just now - basically I cant find a reason why the above is not working.


Unable to open Table : [-3100] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'TransactionEntryItems.returnDateFROM ((Orders INNER JOIN Transactions ON Orders.orderId = Transactions.orderId) INNER JOIN TransactionEntries ON Transactions.transactionId = TransactionEntries.transactionId) INNER JOIN TransactionEntryItems ON TransactionEnt'."


is the problem I am getting
 
forgot to say haha, would anyone be able to have a scan over this and see if i have made any silly mistakes or is there something im just now seeing?
 
Lack of space before the FROM and WHERE keywords.


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry I dont understand what you mean, lack of space?
 
Ah sorry, I understand - an actual space. e.g. " FROM" rather than "FROM"

Thanks alot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top