Within a query, tables or subqueries may be aliased for readability and so that the same table can be referenced more than once in the query with different join conditions.

learn more… | top users | synonyms

6
votes
3answers
88 views

Is using SUM() twice suboptimal?

I know I have to write SUM twice, if I wish to use it in a HAVING clause (or use a derived table otherwise): SELECT id, sum(hours) AS totalhours FROM mytable GROUP BY id HAVING sum(hours) ...
0
votes
2answers
68 views

Multiple Aliases in an SQL Query

Would it be possible to give a table in MySQL query multiple aliases? If so how would I do this?
0
votes
0answers
27 views

Connector Table Hash Values using alias

I am designing a system which stores certain hash values to represent certain pieces of text for example. Each hash value can represent more than one text file. I have 4 tables being the ...
4
votes
1answer
152 views

Besides attaching the debugger, is there any other differences between “(local)\Instance” and “MyLocalName\Instance”?

When using SQL Server Management Studio for SQL Server 2008 R2 connecting to a local SQL Server 2008 R2 instance (version 10.50.2500), I know that if I am using the instance name (local)\sql2008 it ...
9
votes
2answers
566 views

Why are queries parsed in such a way that disallows the use of column aliases in most clauses?

While trying to write a query, I found out (the hard way) that SQL Server parses WHEREs in a query long before parsing the SELECTs when executing a query. The MSDN docs say that the general logical ...
2
votes
1answer
118 views

Alias Names and Two Table Query Problems

I'm quite new to querying databases, I've only been doing it for about 2 weeks in the current job that I'm in and have never touched SQL prior to this. I'm working on trying to use alias names to ...
7
votes
2answers
1k views

Subqueries' aliases same as main queries' aliases

I have an SQL query whose aliases are the same as some of its subquery's aliases. For example: select * from ROOM r where ... ( select * from ROAD r ...