Re: dynamic table query

2003-01-17 Thread Tarik Kutluca
Hi Roger,

you are so right about the query you mentioned.
i was using two other tables for the storage of column and row names since
each aij uses common names for rows and columns, that mixed my mind, but i
will use 1 select query, and make two joins from column-row name tables to
the main  table
but still i need to make another query to learn "n" and "m" from the main
table, but that's okay,
that makes up to 2 queries, instead of n*m queries.

thank you
tarik kutluca

- Original Message -
From: "Roger Baklund" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Tarik Kutluca" <[EMAIL PROTECTED]>
Sent: Friday, January 17, 2003 12:05 PM
Subject: Re: dynamic table query


> * Tarik Kutluca
> > 1. I need to store dynamic sized tables with different row and
> > column sizes, but all small tables ( like 2*5, 3*1,5*3)
> > 2. For this purpose i created a table to store each value of the dynamic
> > sized table, also with the row and the column number, so this is
something
> > like
> >
> > aij for an i*j table in each row storing a, i, j
> >
> > 3. I am trying to figure out the fastest way to obtain the table to a
> > recordset having i*j size, do you think i may accomplish this with a
self
> > join, i couldn't create this sql query,
> >
> > any help would be great, for now, i am using something like this:
> >
> > for i=0 to n
> > for j=0 to m
> > set rsa=cn.execute("SELECT col_id,value from ij where
> > table_id='"+cstr(table_no)+"' and row='"+cstr( i )+"' and col='"+cstr(
> > j )+"'" )
> > next
> > next
> >
> > If i could obtain this matrix with one query from mysql then that would
> > increase my performance, don't you think so?
>
> Yes, it would. But why the self join? Why not simply:
>
> "SELECT col_id,value FROM ij WHERE table_id="+cstr(table_no)+" ORDER BY
> row,col"
>
> If the table_id is an integer, you don't need to quote it. You may want to
> select 'row' and 'col' as well as 'col_id' and 'value', to be able to know
> the current position in the loop.
>
> --
> Roger
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: dynamic table query

2003-01-17 Thread Roger Baklund
* Tarik Kutluca
> 1. I need to store dynamic sized tables with different row and
> column sizes, but all small tables ( like 2*5, 3*1,5*3)
> 2. For this purpose i created a table to store each value of the dynamic
> sized table, also with the row and the column number, so this is something
> like
>
> aij for an i*j table in each row storing a, i, j
>
> 3. I am trying to figure out the fastest way to obtain the table to a
> recordset having i*j size, do you think i may accomplish this with a self
> join, i couldn't create this sql query,
>
> any help would be great, for now, i am using something like this:
>
> for i=0 to n
> for j=0 to m
> set rsa=cn.execute("SELECT col_id,value from ij where
> table_id='"+cstr(table_no)+"' and row='"+cstr( i )+"' and col='"+cstr(
> j )+"'" )
> next
> next
>
> If i could obtain this matrix with one query from mysql then that would
> increase my performance, don't you think so?

Yes, it would. But why the self join? Why not simply:

"SELECT col_id,value FROM ij WHERE table_id="+cstr(table_no)+" ORDER BY
row,col"

If the table_id is an integer, you don't need to quote it. You may want to
select 'row' and 'col' as well as 'col_id' and 'value', to be able to know
the current position in the loop.

--
Roger


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




dynamic table query

2003-01-16 Thread Tarik Kutluca
Hi all,

1. I need to store dynamic sized tables with different row and column sizes,
but all small tables ( like 2*5, 3*1,5*3)
2. For this purpose i created a table to store each value of the dynamic
sized table, also with the row and the column number, so this is something
like

aij for an i*j table in each row storing a, i, j

3. I am trying to figure out the fastest way to obtain the table to a
recordset having i*j size, do you think i may accomplish this with a self
join, i couldn't create this sql query,

any help would be great, for now, i am using something like this:

for i=0 to n
for j=0 to m
set rsa=cn.execute("SELECT col_id,value from ij where
table_id='"+cstr(table_no)+"' and row='"+cstr( i )+"' and col='"+cstr(
j )+"'" )
next
next

If i could obtain this matrix with one query from mysql then that would
increase my performance, don't you think so?

thank you,


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php