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

Derived Table Alias Error

Status
Not open for further replies.

gotstuck

Programmer
Aug 6, 2006
2
US
Hi folks,

[MySQL][ODBC 3.51 Driver][mysqld-5.0.24-community-nt]Every derived table must have its own alias

is the ERROR displayed and my QUERY is

SELECT product FROM (select distinct product from brucedata where (styledesc like 'BRETTON' or styledesc like 'miscellaneous') and series like 'AW' union all select distinct product from brucedata where (styledesc like 'HARTFORD' or styledesc like 'miscellaneous') and series like 'AW' union all select distinct product from brucedata where (styledesc like 'MONTERO' or styledesc like 'miscellaneous') and series like 'AW') group by product having count(product) = 3

I am trying to add aliases but it just doesn't work. Can someone show me the correct way to add aliases, so the query works?

Thanks
 
Just insert a name, any name, after the closing bracket terminating each sub-select.
 
i tried it tony, it didnt work, i dont know if it has to do something with parantheses?
 
Brackets/parentheses/whatever - I call them brackets.

You have:[tt]
... FROM (SELECT ... ) GROUP BY ...[/tt]
Replace it with:[tt]
... FROM (SELECT ... ) sq GROUP BY ...[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top