newbie: select from a table, conditioned on the entry in another table

2005-10-29 Thread Christoph Lehmann

Hi
I have 2 tables, say A and B. One field in table A, say A_link, points 
to a field B_link in table B. I need to select entries in A, which 
fulfill two conditions: A_cond1 = XX and B_cond2 = YY.


E.g
tabel A table B

A_cond1 A_link  B_link  B_cond2
1   aa  aa  A
1   aa  ac  B
1   ac  dd  A
2   dd  ef  C
2   ef  
3   aa
3   dd
3   dd
4   ac
4   ac
4   ef

How can I now define a select statement such as:

SELECT* from A WHERE A_cond1 BETWEEN 1 AND 3 and corresponding field 
B_cond2 = A


this would return

A_cond1 A_link
1   aa
1   aa
2   dd
3   dd
3   dd

many thanks for your kind help

best regards
Christoph

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



newbie: how to sort a database without extracting the data

2005-05-03 Thread Christoph Lehmann
Hi
I am really new to mysql. I need my database to be sorted according to 
one field. But since the database with 1200 records is huge, I don't 
want to do it using SELECT.
What I need is just the stored database being sorted on hard-disk. Is 
there any way doing this like creating a new database and importing the 
old one but being sorted?

many thanks for your kind help
cheers
christoph
(p.s. I need this for later chunk-wise data-fetch with one chunk being 
homogenous in regard to one (the sorted) field)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: newbie: how to sort a database without extracting the data

2005-05-03 Thread Christoph Lehmann
thanks Damian
but I don't understand this: My field according to which I want the
database to be sorted IS an unique number.
eg I have
1 ab 33
1 cd 21
1 ac 32
2 aa 22
2 cd 25
3 kw 03
3 ie 02
2 ei 05
2 wk 00
I need it in the form:
1 ab 33
1 cd 21
1 ac 32
2 aa 22
2 cd 25
2 ei 05
2 wk 00
3 kw 03
3 ie 02
what do you mean by adding an index
thanks for your help
cheers
christoph
Damian McMenamin wrote:
add an index on the field. would be quickerthan any  exporting
importing.
--- Christoph Lehmann [EMAIL PROTECTED] wrote:
Hi
I am really new to mysql. I need my database to be sorted according
to 
one field. But since the database with 1200 records is huge, I
don't 
want to do it using SELECT.
What I need is just the stored database being sorted on hard-disk. Is

there any way doing this like creating a new database and importing
the 
old one but being sorted?

many thanks for your kind help
cheers
christoph
(p.s. I need this for later chunk-wise data-fetch with one chunk
being 
homogenous in regard to one (the sorted) field)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:   
http://lists.mysql.com/[EMAIL PROTECTED]


Yours Sincerely,
Damian McMenamin
Analyst Programmer
Melbourne 
Australia
Cell: (61)040-0064107
Email: [EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


newbie: delete row xy

2005-05-02 Thread Christoph Lehmann
Hi
I now how to use delete together with a WHERE statement. But e.g. after 
some warnings revealed me certain rows being inconsisent, and I want to 
delete them- how can I do this? I just know that I want to delete e.g 
row 1433 (I have no special id)

thanks for a hint
cheers
christoph
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]