[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Building query string
From:       Sven Burmeister <Sven.Burmeister () gmx ! net>
Date:       2000-11-20 12:52:02
[Download RAW message or body]

Hi guys,

I have a really basic problem but still I cannot find a soultion so
maybe you can help me.

I have two tables, completely different conten and structure, just the
first field is the same the ID.

Tables looks like this:

ID	|	1	|	2	|...
--------------------------------------------
1	|1;145W;233T	|0;123W;344T;
2	|
.
.
.

ID	|	country	|	city	|
---------------------------------------------
1	|netherlands	|amsterdam
2	|
.
.
.

I now want to find all ID from both tables which check the criteria for

country='netherlands' AND city='amsterdam'

and now the problem. I thought I could use regulary(?) expressions to
ask for the second part of the string in the second table. Imagine 145
would stand for a price. I now want to get all IDs which equal or are
smaller than 200.

1<='[%200W]%'
next tries were:
1='[%0-200]W%'
1='[*0-200]W*'
1 LIKE '%200W%' OR '%199W%'... (after a certain amount of ORs it did not
work out.

Another idea was using REGEXP, but I do not know how to use it.
Pretty basic, I know, but I am just getting started.

How do I join the two tables for this purpose?
SELECT ID FROM table1 WHERE ... AS results1 FROM table2 WHERE ... AS
result2
and then?

Thanks a lot to all that do not consider this problem as too basic!

Cheers,

Sven

-- 
---------------------------------------------------------------------
Please check "http://www.mysql.com/documentation/manual.php" before
posting. To request this thread, e-mail mysql-thread56835@lists.mysql.com

To unsubscribe, send a message to:
    <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>

If you have a broken mail client that cannot send a message to
the above address (Microsoft Outlook), you can use:
    http://lists.mysql.com/php/unsubscribe.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic