|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
* Question about SQL 2000 queryIn SQL 2000 Enterprise Manager, when I type this query:
SELECT * FROM Users u, Companies c where u.CompanyID = c.CompanyID it always converts to: SELECT * FROM USERS u INNER JOIN COMPANIES c ON u.CompanyID = c.CompanyID Why does it do that? Can I prevent it from doing the conversion? No, you have no control over that behavior. Further, you are using the old
style join syntax. You better get used to the new ANSI standard join syntax. Also, Enterprise Manager is not the right tool for writing queries. Please use Query Analyser instead. Show quote "David R." <davidrnoreply@nospam.com> wrote in message news:%23ecQYwDrGHA.3592@TK2MSFTNGP02.phx.gbl... > In SQL 2000 Enterprise Manager, when I type this query: > > > SELECT * > FROM Users u, Companies c > where u.CompanyID = c.CompanyID > > > it always converts to: > > > SELECT * > FROM USERS u INNER JOIN > COMPANIES c ON u.CompanyID = c.CompanyID > > > Why does it do that? Can I prevent it from doing the conversion? > David R. wrote:
Show quote > In SQL 2000 Enterprise Manager, when I type this query: Most people seem to prefer the INNER JOIN syntax. For one thing it is> > > SELECT * > FROM Users u, Companies c > where u.CompanyID = c.CompanyID > > > it always converts to: > > > SELECT * > FROM USERS u INNER JOIN > COMPANIES c ON u.CompanyID = c.CompanyID > > > Why does it do that? Can I prevent it from doing the conversion? much easier to understand when you have multiple joins involved. As to why EM's query designer does it that way, it's probably because the JOIN syntax is required for outer joins so I expect they wanted a consistent approach for inner joins too. Is there a way to avoid it? Certainly. Write your queries in Query Analyzer. That's what it's best for. The EM designer is a very blunt instrument with which to develop queries. -- David Portas, SQL Server MVP Whenever possible please post enough code to reproduce your problem. Including CREATE TABLE and INSERT statements usually helps. State what version of SQL Server you are using and specify the content of any error messages. SQL Server Books Online: http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx -- I actually find the syntax
> > SELECT * easier to understand than> > FROM Users u, Companies c > > where u.CompanyID = c.CompanyID > > SELECT * I'd like to learn and understand the latter constructs. Can you direct me> > FROM USERS u INNER JOIN > > COMPANIES c ON u.CompanyID = c.CompanyID to a site that explains it well? Show quote "David Portas" <REMOVE_BEFORE_REPLYING_dpor***@acm.org> wrote in message news:1153428420.106771.97330@b28g2000cwb.googlegroups.com... > David R. wrote: > > In SQL 2000 Enterprise Manager, when I type this query: > > > > > > SELECT * > > FROM Users u, Companies c > > where u.CompanyID = c.CompanyID > > > > > > it always converts to: > > > > > > SELECT * > > FROM USERS u INNER JOIN > > COMPANIES c ON u.CompanyID = c.CompanyID > > > > > > Why does it do that? Can I prevent it from doing the conversion? > > > Most people seem to prefer the INNER JOIN syntax. For one thing it is > much easier to understand when you have multiple joins involved. As to > why EM's query designer does it that way, it's probably because the > JOIN syntax is required for outer joins so I expect they wanted a > consistent approach for inner joins too. > > Is there a way to avoid it? Certainly. Write your queries in Query > Analyzer. That's what it's best for. The EM designer is a very blunt > instrument with which to develop queries. > > -- > David Portas, SQL Server MVP > > Whenever possible please post enough code to reproduce your problem. > Including CREATE TABLE and INSERT statements usually helps. > State what version of SQL Server you are using and specify the content > of any error messages. > > SQL Server Books Online: > http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx > -- > |
|||||||||||||||||||||||