HELP Needed to come up with a DB Search.

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default HELP Needed to come up with a DB Search.

    Hi all,

    I'll try to keep this brief so if you are interested, shoot me an email and I'll get out the
    specifics if you need more info. I don't know ASP but I know that I pretty much have to use it to
    accomplish what I want since ths store is an ASP store.

    I have a database that is for an online store. The DB has 3 tables that I am dealing with.

    Table 1 (ORDERS) contains information on orders that are placed. Includes info like name, address,
    etc and has an OrderID field.

    Table 2 (ITEMS) contains a list of items ordered. It references the OrderID so you can tell what
    items go with what orders. Primary field is the RowID field.

    Table 3 (OPTIONS) has a list of options specified for certain items. Each option is it's own entry
    and each item can have multiple options. This table references the RowID field so you know what
    options go with what item and on what order.
    E.g. If item 123 is ordered and has 4 options the customer chose, item 123 will appear 4 times in
    Table 3, one for each option.

    PROBLEM
    Here's what I'm trying to end up with.

    I need to be able to have all the information for a particular item ordered on one row in a
    table/spreadsheet/whatever.

    So if John Smith ordered Item 123 and specified Large, Blue, Square, and Heavy as his options, I'd
    want a row that would basically show:

    John, Smith, address, Item 123, large, blue, square, heavy.

    Getting the name and address info isn't the main problem because it's just pulling a row, but
    getting the 4 rows from Table 3 and putting them in 1 row with the other data, I don't know how to
    do.

    This all keys off the specific Item I'm looking for...

    So basically

    -Find every entry in the Items table that has Item ID XXX and record the Order ID and Row ID
    -Get the corresponding customer info from the Orders table via the Order ID
    -Get the corresponding 4 Option records from the Options table finding all entries with the Row ID
    from step 1.

    ~~~~~~~~~~~~~~~~~~~~~~~~`

    Hopefully that made sense. I don't think this would be hard to do if you actually know ASP so if
    anyonew ould be willing to work with me on this, I can provide the specifics about the database,
    table names, etc to try to make something work.

    Please let me know if you are interested or have other question. Feel free to reply here or email me
    directly.

    Thanks!

    --Mike
    [email]--XkelemvorX@XexecpcX.Xcom[/email]X (remove the X's)
    Mr B Guest

  2. Similar Questions and Discussions

    1. help needed reg. sms thru cfm
      could anyone help me out in sending sms thru coldfusion server....as for as i know that can happen only with coldfusion 7 server.kindly clarify if...
    2. ANN: InterAKT Site Search - search in multiple tables
      Hello, We have just released a new product, MX Site Search, meant to help web developers and designers create a search form in their dynamic...
    3. #25786 [NEW]: PHP website uses cookies to remember last search phrase in search box
      From: tipsen at imada dot sdu dot dk Operating system: - PHP version: Irrelevant PHP Bug Type: Unknown/Other Function Bug...
    4. Search within Search Results
      I am trying to do a search within query results: My first search executes fine, but my second search uses the WHERE parameters of my first...
    5. XP Search - how to not search inside .ZIP files
      Is there any way to make the Windows Explorer Search facility not search the contents of .ZIP files?
  3. #2

    Default Re: HELP Needed to come up with a DB Search.

    "Mr B" <ladeeda@hahaha.com> wrote in message
    news:ae4000t3mevs72ltkb0huoh4iddtskhgog@4ax.com...
    > Hi all,
    >
    > I'll try to keep this brief so if you are interested, shoot me an email
    and I'll get out the
    > specifics if you need more info. I don't know ASP but I know that I pretty
    much have to use it to
    > accomplish what I want since ths store is an ASP store.
    >
    > I have a database that is for an online store. The DB has 3 tables that I
    am dealing with.
    >
    > Table 1 (ORDERS) contains information on orders that are placed. Includes
    info like name, address,
    > etc and has an OrderID field.
    >
    > Table 2 (ITEMS) contains a list of items ordered. It references the
    OrderID so you can tell what
    > items go with what orders. Primary field is the RowID field.
    >
    > Table 3 (OPTIONS) has a list of options specified for certain items. Each
    option is it's own entry
    > and each item can have multiple options. This table references the RowID
    field so you know what
    > options go with what item and on what order.
    > E.g. If item 123 is ordered and has 4 options the customer chose, item 123
    will appear 4 times in
    > Table 3, one for each option.
    >
    > PROBLEM
    > Here's what I'm trying to end up with.
    >
    > I need to be able to have all the information for a particular item
    ordered on one row in a
    > table/spreadsheet/whatever.
    >
    > So if John Smith ordered Item 123 and specified Large, Blue, Square, and
    Heavy as his options, I'd
    > want a row that would basically show:
    >
    > John, Smith, address, Item 123, large, blue, square, heavy.
    >
    > Getting the name and address info isn't the main problem because it's just
    pulling a row, but
    > getting the 4 rows from Table 3 and putting them in 1 row with the other
    data, I don't know how to
    > do.
    >
    > This all keys off the specific Item I'm looking for...
    >
    > So basically
    >
    > -Find every entry in the Items table that has Item ID XXX and record the
    Order ID and Row ID
    > -Get the corresponding customer info from the Orders table via the Order
    ID
    > -Get the corresponding 4 Option records from the Options table finding all
    entries with the Row ID
    > from step 1.
    >
    > ~~~~~~~~~~~~~~~~~~~~~~~~`
    >
    > Hopefully that made sense. I don't think this would be hard to do if you
    actually know ASP so if
    > anyonew ould be willing to work with me on this, I can provide the
    specifics about the database,
    > table names, etc to try to make something work.
    >
    > Please let me know if you are interested or have other question. Feel free
    to reply here or email me
    > directly.
    >
    > Thanks!
    >
    > --Mike
    > [email]--XkelemvorX@XexecpcX.Xcom[/email]X (remove the X's)

    Perhaps this will help; watch for word-wrap:

    SELECT
    ORDERS.OrderID,
    ORDERS.Name,
    ITEMS.ItemDescription,
    ITEMS.RowID,
    OPTIONS.OptionDescription
    FROM (ORDERS
    INNER JOIN ITEMS
    ON ITEMS.OrderID = ORDERS.OrderID)
    INNER JOIN OPTIONS
    ON OPTIONS.RowID = ITEMS.RowID
    WHERE ORDERS.OrderID = 1
    ORDER BY
    ORDERS.Name,
    ITEMS.ItemDescription,
    OPTIONS.OptionDescription;

    This SQL statement will return one row for each OPTIONS row that exists for
    each ITEMS row as well as one row for each ITEMS row that exists for each
    ORDERS row.

    Just loop through the resulting recordset and break on each OPTIONS within
    ITEMS within ORDERS.

    Remove the "WHERE ORDERS.OrderID = 1 " line for all ORDERS.

    Of course, your field names may differ.


    McKirahan 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