Query a result that should first be concatenated based on a sku & sequence number
Posted on 2004-09-15
I have an asp script connecting to a db through and ODBC connection.
The actual database type is ProvideX.
The table that I am having the most difficulty contains 4 fields: Sku,Description,Size,SequenceNumber.
Comma separated example data of two products may be observed below;
ITEM01,This is a test descr,,001
ITEM01,iption for your info,,002
ITEM02,This is another one ,,001
The Description field has a maximum character length of 20 in my example. As shown, the first row specifies the total size of the complete product description, but does not contain a value in the Description field and always has a SequenceNumber of 000. Following rows contain the complete description which is broken up in increments of 20 characters of description per row with a SequenceNumber incremented according to the number of rows needed to account for the complete description.
The first, main issue I am having a problem with is, I need sample code that will query / build a single, complete description string which can then be keyword searched & return the complete description. So for ITEM01, my intent is to use a keyword of "description" successfully & return the complete description of the result(s).
My current query which is far off from satisfactory looks like this;
<form name="frmQuery" action="<%= strURL %>" method="get">
<input name="search" value="<%= strSearch %>">
<input value="Search" type="submit">
If strSearch <> "" Then
<!-- #include file = "db_connect.asp" -->
' Build our query based on the input.
strSQL = "SELECT Sku, SequenceNumber, Description
& "FROM ItemEndedDescription " _
& "WHERE Description LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY Sku, SequenceNumber"
I look forward to your response.