----- Original Message ----- 
From: "kalin mintchev" <[EMAIL PROTECTED]>
To: "Adam" <[EMAIL PROTECTED]>
Cc: "MySQL General" <[EMAIL PROTECTED]>
Sent: Sunday, November 14, 2004 11:33 PM
Subject: Re: syntax question..


>
> > Kalin,
> >
> > Kalin> thanks to all... yes, Rhino - i'm new. my first
> > Kalin> post. the version is the problem indeed. it's
> > Kalin> 4.0.13-standard. how would i achieve the same
> > Kalin> query in this version?...
> >
> > You'll need to provide the following:
> >
> > (1) What is the result you want to achieve?
> well:
> this is what i wrote:
> select t1.data from table1 as t1 where t1.zip=(select * from table2 as t2
> where t2.chain like "%carmike%");
>
> i guess this will make more sense:
> basically i'm looking for the data in t1.data - which is varchar - that
> has a zip  value of the record(s)  that contain the name "carmike" in
> their "chain" field in table2...
>
> does this make sense?
>

Not entirely. It sounds like you are saying that the zip value is in the
column called 'data'. From your query, it appears that the zip code is in
the column called 'zip'. I *think* you mean to say that for every row in
table1 that contains a give the same zip code as the zip code of
'%carmike%', you want to see some other information in the same row, which
you are calling 'data' in your example.

There are probably a few different ways to do this query. I'm going to
suggest one possible approach but it is not necessarily the best one; others
may come along later to suggest a better approach.

I think you need to do something like this:

select t1.data
from table1 t1 inner join table2 t2 on t1.zip = t2.zip
where t2.chain like '%carmike%';

You haven't provided full descriptions of the tables and their columns and I
have no idea what the data in the tables actually is so I can't try this for
you to be sure it works. However, it should be pretty close to what you
need. Give it a try and let us know what error messages you get. If you
don't get error messages but the result is incorrect, describe the result
that you got and how it differed from the result you expected. Then we can
probably help you figure out what went wrong.

Rhino


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

Reply via email to