Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    10

    Unanswered: Query Help!!! ASAP

    i'm trying to run this query,

    SELECT clients.clientID, client_cities.city
    FROM tblCities INNER JOIN (client_cities INNER JOIN clients ON client_cities.clientID = clients.clientID) ON tblCities.cityID = client_cities.city WHERE (((tblCities.cityName)="San Mateo" And (tblCities.cityName)="Daly City"));

    if i have an id that can have several cities, shouldn't it display the id? my query returns nothing. i.e. id 2 can be found in San Francisco and Daly City.

    Here's an example of what i've been working on.

    cityTable - Table name
    cityID as Number (Primary Key)
    cityName as Text

    ClientTable
    clientID as Number (Primary Key)
    clientName as Text

    ClientCityTable
    clientID as number
    ctyID as number

    i thought i kept this fairly simple, but perhaps i have it wrong.

    is it not possible to search one column with using the "And" operator instead of the "Or" operator???

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Query Help!!! ASAP

    Originally posted by CookieMonster24
    i'm trying to run this query,

    SELECT clients.clientID, client_cities.city
    FROM tblCities INNER JOIN (client_cities INNER JOIN clients ON client_cities.clientID = clients.clientID) ON tblCities.cityID = client_cities.city WHERE (((tblCities.cityName)="San Mateo" And (tblCities.cityName)="Daly City"));

    if i have an id that can have several cities, shouldn't it display the id? my query returns nothing. i.e. id 2 can be found in San Francisco and Daly City.

    Here's an example of what i've been working on.

    cityTable - Table name
    cityID as Number (Primary Key)
    cityName as Text

    ClientTable
    clientID as Number (Primary Key)
    clientName as Text

    ClientCityTable
    clientID as number
    ctyID as number

    i thought i kept this fairly simple, but perhaps i have it wrong.

    is it not possible to search one column with using the "And" operator instead of the "Or" operator???
    You're problem is that you're trying to filter on mutually exclusive values for cityName. You should be using an OR if you want either cities ... Since for each row the cityName cannot be both "San Mateo" and "Daly City" at the same time ...

  3. #3
    Join Date
    May 2003
    Posts
    10
    i was able to solve this using "And exists". That did what i was looking for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •