這裏是情況,我有一個表格,顯示一些值,而且有一個cfoutput裏面另一個,因此currentrows分別計算,無論如何,我希望一切都將清晰後源:cfoutput cfoutput裏面cfoutput
<cfquery name="get_products" datasource="#dsn3#">
SELECT P.PRODUCT_ID,P.PRODUCT_NAME,PS.MONEY,PR.PRICE,P.BRAND_ID,PS.PRICE,GSL.PRODUCT_STOCK,GSL.PURCHASE_ORDER_STOCK,GSL.SALEABLE_STOCK,P.PRODUCT_DETAIL2,P.BARCOD
FROM PRODUCT P
JOIN PRICE_STANDART PS ON P.PRODUCT_ID = PS.PRODUCT_ID
JOIN PRICE PR ON P.PRODUCT_ID = PR.PRODUCT_ID
JOIN #DSN2_ALIAS#.GET_STOCK_LAST GSL ON P.PRODUCT_ID = GSL.PRODUCT_ID
<cfif isdefined('attributes.is_stock') and attributes.is_stock is 1>
AND GSL.PRODUCT_STOCK > 0
</cfif>
<cfif isdefined('attributes.product_catid') and len(attributes.product_catid)>
JOIN PRODUCT_CAT PC ON P.PRODUCT_CATID = PC.PRODUCT_CATID
</cfif>
WHERE PS.PURCHASESALES=1 AND PS.PRICESTANDART_STATUS=1 AND P.IS_SALES=1 AND P.IS_PURCHASE=1 AND P.IS_INTERNET=1 AND P.IS_EXTRANET=1
AND PR.STARTDATE <= #now()# AND (PR.FINISHDATE >= #now()# OR PR.FINISHDATE IS NULL)
GROUP BY P.PRODUCT_ID,PR.PRICE,P.PRODUCT_NAME,PS.MONEY,P.BRAND_ID,PS.PRICE,GSL.PRODUCT_STOCK,GSL.PURCHASE_ORDER_STOCK,GSL.SALEABLE_STOCK,P.PRODUCT_DETAIL2,P.BARCOD
P.PRODUCT_ID, PR.PRICE DESC
</cfquery>
則表:
<cfoutput query="get_products" startrow="#attributes.startrow#" maxrows="#attributes.maxrows#" group="product_id">
<tr height="20" onMouseOver="this.className='color-light';" onMouseOut="this.className='color-row';" class="color-row">
<td>
<a href="/index.cfm?fuseaction=product.form_upd_product&pid=#product_id#" style="color:blue;" target="_blank">#left(product_name,50)#</a>
</td>
<td>#left(PRODUCT_DETAIL2,50)#</td>
<td align="center"><cfif len(brand_list)>#get_brands.brand_name[listfind(brand_list,brand_id,',')]#</cfif></td>
<td align="center">#PRODUCT_STOCK#</td>
<td align="center">#saleable_stock#</td>
<td align="center">#purchase_order_stock#</td>
<cfoutput><td align="center">#tlformat(price,2)# <cfif currentrow eq 4>asd</cfif></td></cfoutput>
<td align="center"><a href="javascript://" onclick="gizle_goster(abr#currentrow#);" style="font-weight:bold;">x #saleable_stock#</a></td>
<td align="center">#MONEY#</td>
</tr>
<tr onMouseOver="this.className='color-light';" onMouseOut="this.className='color-row';" class="color-row" id="abr#currentrow#" style="display:none;">
<td colspan="3"></td>
<td colspan="3" style="color:blue;font-weight:bold;text-align:center;">#saleable_stock# x</td>
<cfoutput>
<td align="center" style="color:red;font-weight:bold;text-align:center;">#tlformat((saleable_stock*price),2)#</td>
<cfset abr = tlformat((saleable_stock*price),2)>
</cfoutput>
<td align="center" colspan="2">#MONEY#</td>
</tr>
</cfoutput>
和結果: http://s008.radikal.ru/i303/1110/2a/031496096958.png
,你可以看到寫着「爲d「僅顯示在外部cfoutput的第一行中,但在內部cfoutput的第4行中顯示。 (一行有4個價格) 我想要的只是在外部cfoutput的每一行中寫入「asd」,並在內部行的第四行中寫入「asd」。
謝謝大家的幫助!
不要忘記'ORDER BY Product_id,...',以確保分組始終按預期工作。 – Leigh