|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello, I am trying to come up with a way to preform the same query over a list of tables; of which the tablenames are stored in a ... table. I have tried numerous ways but unfortunatly the column name is not expanded or treated as the tablename in the outerquery. So I am trying now with a subquery only to get caught in the alias mixer. For example: mysql> SELECT open,high,low,close FROM (SELECT tablename FROM properties); ERROR 1248 (42000): Every derived table must have its own alias Is there a way to receive the list of tablenames and preform a subquery within the same select statement ? If so I am going to keep searching for the answer using subquery otherwise I will have to come up with something else. Thank you for any suggestions. Cheers, Hans. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 3 Oct, 13:18, hans christian <christ...@notmail.com> wrote:
> Hello, I am trying to come up with a way to preform the same query over a > list of tables; of which the tablenames are stored in a ... table. > > I have tried numerous ways but unfortunatly the column name is not > expanded or treated as the tablename in the outerquery. So I am trying > now with a subquery only to get caught in the alias mixer. For example: > > mysql> SELECT open,high,low,close FROM (SELECT tablename FROM properties); > ERROR 1248 (42000): Every derived table must have its own alias > > Is there a way to receive the list of tablenames and preform a subquery > within the same select statement ? > > If so I am going to keep searching for the answer using subquery > otherwise I will have to come up with something else. > > Thank you for any suggestions. > > Cheers, > > Hans. I think you need a stored procedure |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Wed, 03 Oct 2007 05:58:20 -0700, Captain Paralytic wrote:
> On 3 Oct, 13:18, hans christian <christ...@notmail.com> wrote: >> Hello, I am trying to come up with a way to preform the same query over >> a list of tables; of which the tablenames are stored in a ... table. >> >> I have tried numerous ways but unfortunatly the column name is not >> expanded or treated as the tablename in the outerquery. So I am trying >> now with a subquery only to get caught in the alias mixer. For example: >> >> mysql> SELECT open,high,low,close FROM (SELECT tablename FROM >> properties); ERROR 1248 (42000): Every derived table must have its own >> alias >> >> Is there a way to receive the list of tablenames and preform a subquery >> within the same select statement ? >> >> If so I am going to keep searching for the answer using subquery >> otherwise I will have to come up with something else. >> >> Thank you for any suggestions. >> >> Cheers, >> >> Hans. > > I think you need a stored procedure Hmmm 2 bad ![]() Anyway thank you for your answer ! Hans. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 3 Oct, 21:50, hans christian <christ...@notmail.com> wrote:
> On Wed, 03 Oct 2007 05:58:20 -0700, Captain Paralytic wrote: > > On 3 Oct, 13:18, hans christian <christ...@notmail.com> wrote: > >> Hello, I am trying to come up with a way to preform the same query over > >> a list of tables; of which the tablenames are stored in a ... table. > > >> I have tried numerous ways but unfortunatly the column name is not > >> expanded or treated as the tablename in the outerquery. So I am trying > >> now with a subquery only to get caught in the alias mixer. For example: > > >> mysql> SELECT open,high,low,close FROM (SELECT tablename FROM > >> properties); ERROR 1248 (42000): Every derived table must have its own > >> alias > > >> Is there a way to receive the list of tablenames and preform a subquery > >> within the same select statement ? > > >> If so I am going to keep searching for the answer using subquery > >> otherwise I will have to come up with something else. > > >> Thank you for any suggestions. > > >> Cheers, > > >> Hans. > > > I think you need a stored procedure > > Hmmm 2 bad ![]() > > Anyway thank you for your answer ! > > Hans.- Hide quoted text - > > - Show quoted text - Why 2bad? |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Thu, 04 Oct 2007 04:44:52 -0700, Captain Paralytic wrote:
> On 3 Oct, 21:50, hans christian <christ...@notmail.com> wrote: >> On Wed, 03 Oct 2007 05:58:20 -0700, Captain Paralytic wrote: >> > On 3 Oct, 13:18, hans christian <christ...@notmail.com> wrote: >> >> Hello, I am trying to come up with a way to preform the same query >> >> over a list of tables; of which the tablenames are stored in a ... >> >> table. >> >> >> I have tried numerous ways but unfortunatly the column name is not >> >> expanded or treated as the tablename in the outerquery. So I am >> >> trying now with a subquery only to get caught in the alias mixer. >> >> For example: >> >> >> mysql> SELECT open,high,low,close FROM (SELECT tablename FROM >> >> properties); ERROR 1248 (42000): Every derived table must have its >> >> own alias >> >> >> Is there a way to receive the list of tablenames and preform a >> >> subquery within the same select statement ? >> >> >> If so I am going to keep searching for the answer using subquery >> >> otherwise I will have to come up with something else. >> >> >> Thank you for any suggestions. >> >> >> Cheers, >> >> >> Hans. >> >> > I think you need a stored procedure >> >> Hmmm 2 bad ![]() >> >> Anyway thank you for your answer ! >> >> Hans.- Hide quoted text - >> >> - Show quoted text - > > Why 2bad? Because I'm lazy ... Hans. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Hello,
i have the same problem. Did you find then answer, please? J |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Oct 3, 1:18 pm, hans christian <christ...@notmail.com> wrote:
> Hello, I am trying to come up with a way to preform the same query over a > list of tables; of which the tablenames are stored in a ... table. > > I have tried numerous ways but unfortunatly the column name is not > expanded or treated as the tablename in the outerquery. So I am trying > now with a subquery only to get caught in the alias mixer. For example: > > mysql> SELECT open,high,low,close FROM (SELECT tablename FROM properties); > ERROR 1248 (42000): Every derived table must have its own alias > > Is there a way to receive the list of tablenames and preform a subquery > within the same select statement ? > > If so I am going to keep searching for the answer using subquery > otherwise I will have to come up with something else. > > Thank you for any suggestions. > > Cheers, > > Hans. Hi Hans Try this: "SELECT open,high,low,close FROM (SELECT tablename FROM properties) as my_table; " |
|
![]() |
| Outils de la discussion | |
|
|