Ask a Question related to ASP Database, Design and Development.
-
Mr B #1
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
-
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... -
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... -
#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... -
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... -
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? -
McKirahan #2
Re: HELP Needed to come up with a DB Search.
"Mr B" <ladeeda@hahaha.com> wrote in message
news:ae4000t3mevs72ltkb0huoh4iddtskhgog@4ax.com...and I'll get out the> Hi all,
>
> I'll try to keep this brief so if you are interested, shoot me an emailmuch have to use it to> specifics if you need more info. I don't know ASP but I know that I prettyam dealing with.> 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 Iinfo like name, address,>
> Table 1 (ORDERS) contains information on orders that are placed. IncludesOrderID so you can tell what> etc and has an OrderID field.
>
> Table 2 (ITEMS) contains a list of items ordered. It references theoption is it's own entry> items go with what orders. Primary field is the RowID field.
>
> Table 3 (OPTIONS) has a list of options specified for certain items. Eachfield so you know what> and each item can have multiple options. This table references the RowIDwill appear 4 times in> options go with what item and on what order.
> E.g. If item 123 is ordered and has 4 options the customer chose, item 123ordered on one row in a> 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 itemHeavy as his options, I'd> table/spreadsheet/whatever.
>
> So if John Smith ordered Item 123 and specified Large, Blue, Square, andpulling a row, but> 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 justdata, I don't know how to> getting the 4 rows from Table 3 and putting them in 1 row with the otherOrder ID and Row ID> 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 theID> -Get the corresponding customer info from the Orders table via the Orderentries with the Row ID> -Get the corresponding 4 Option records from the Options table finding allactually know ASP so if> from step 1.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~`
>
> Hopefully that made sense. I don't think this would be hard to do if youspecifics about the database,> anyonew ould be willing to work with me on this, I can provide theto reply here or email me> table names, etc to try to make something work.
>
> Please let me know if you are interested or have other question. Feel free> 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



Reply With Quote

