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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using NoLock with table alias

Status
Not open for further replies.

nelco

Programmer
Apr 4, 2006
93
0
0
US
Hi,
I am not sure on the syntax of using table alias with NoLock condition. The query I tried is as follows:
Code:
Select U.Login, EMAIL
From		MetaQuotes_VelocityDemo.mt4_users NoLock AS U LEFT JOIN MetaQuotes_VelocityDemo.mt4_Trades NoLock AS T ON (U.Login = T.Login)
I even tried this:
Code:
Select U.Login, EMAIL
From		MetaQuotes_VelocityDemo.mt4_users AS U NOLOCK LEFT JOIN MetaQuotes_VelocityDemo.mt4_Trades AS T NOLOCK ON (U.Login = T.Login)
I keep getting a syntax error. Could someone help in getting the right syntax?
 
That would be because MySQL doesn't support a NoLock keyword. The reason it appears to work without the table alias is because MySQL lets you specify the table alias without the AS keyword. So the query "SELECT * FROM table1 NoLock" would make NoLock the alias for table1, but would not affect locking.

You might achieve a similar result by changing the transaction isolation level, as suggested here.
 
Thanks for your help, AdaHacker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top