How to filter one database query by another

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default How to filter one database query by another

    What I am hoping to do is filter one database query by another. I have two
    databases and they both have a field call vehicle_type. What I want to happen
    is that vehicle_type from the products database filters what is shown from the
    accessories database. These are my SQL queries SELECT * FROM products WHERE
    id = %s', SELECT * FROM accessories WHERE vehicle_type='''; I think the
    accessories query should look like SELECT * FROM accessories WHERE
    vehicle_type=''$vehicle_type'; but I don't know how to give $vehicle_type a
    value from the products database. Hope this makes sense, any help would be
    greatly appreciated. Thanks Dennis :0)

    DennisMcDougall Guest

  2. Similar Questions and Discussions

    1. #40499 [NEW]: filter sapi does not register any highlightning filter
      From: php at henke37 dot cjb dot net Operating system: any PHP version: 6CVS-2007-02-15 (CVS) PHP Bug Type: Apache2 related...
    2. Filter Query
      ok i have this <cfset mypdf = "name"> <cfset mypdf = GetToken(mypdf, 1, "_")> <cfoutput>#mypdf#</cfoutput> <cfset session.fkcliente = "name"> ...
    3. Filter by MshORAddresses in an LDAP query
      I am trying to query an LDAP server, and search for part of a string within the mshORAddresses field. This field is a string that is comma delimited...
    4. Dynamic Query Filter
      I have a query which returns a very long list of my members, and would like to create a select box at the top of the page that allows the user to...
    5. Query Filter
      I have a salesman who mostly reports information outside of the US, but occasionly, he will put in a report for a company in the US. He also needs...
  3. #2

    Default Re: How to filter one database query by another

    Join the tables in a single recordset. A basic outline (don't use SELECT
    *):

    SELECT P.ProductField1, P.ProductField2, A.AccessoryField1,
    A.AccessoryField2, etc, for all the fields you need
    FROM products P INNER JOIN accessories A ON P.vehicle_type=A.vehicle_type
    WHERE P.id=%s


    "DennisMcDougall" <webforumsuser@macromedia.com> wrote in message
    news:d0dv6i$g7t$1@forums.macromedia.com...
    > What I am hoping to do is filter one database query by another. I have
    two
    > databases and they both have a field call vehicle_type. What I want to
    happen
    > is that vehicle_type from the products database filters what is shown from
    the
    > accessories database. These are my SQL queries SELECT * FROM products
    WHERE
    > id = %s', SELECT * FROM accessories WHERE vehicle_type='''; I think the
    > accessories query should look like SELECT * FROM accessories WHERE
    > vehicle_type=''$vehicle_type'; but I don't know how to give $vehicle_type
    a
    > value from the products database. Hope this makes sense, any help would
    be
    > greatly appreciated. Thanks Dennis :0)
    >

    CMBergin Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139