var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: crosstab query help
I am trying to use a crosstab query to query this table (promo_params):
with the output looking like this:
PLNRCODE PARAM VALUE INSERT_DATETIME
M32 Abc A 05/17/2007 09:26:17
M32 Abc B 05/17/2007 09:26:17
M32 Abc C 05/17/2007 09:26:17
M32 DaysOfSupply 90 05/17/2007 09:26:17
M32 DlrGrp TRUCKENTR 05/17/2007 09:26:17
M32 PromoCode MAY2007ALL 05/17/2007 09:26:17
M32 PromoCode MAY2007US 05/17/2007 09:26:17
The part that is stumping me is that the DLRCODE value comes from another table. Here's the query that pulls the codes: SELECT loc FROM loc WHERE p_dlrgrp = 'GRP-A'
DLRCODE GROUP DAYS PLNRCODE
T100 GRP-A 90 M32
T200 GRP-A 90 M32
T300 GRP-A 90 M32
T400 GRP-A 90 M32
T500 GRP-A 90 M32
I can't seem to figure out how to do this because this query returns multiple rows.
I'm looking at it and all I can say is: there's no way to get the OUTPUT from the INPUT.
Instead of posting such a mess, you'd better provide CREATE TABLE and INSERT INTO sample data statements; then we'll be able to create testing environment and try to do something about it.
However, it is quite late here so - perhaps I'm not seeing obvious. If that's the case, I apologize.
From what I can see you are looking for the VALUE from the promo_params table where the PARAM is DaysOfSupply which joins another table (unspecified) that has the DLRCODE in it. However I don't see where your JOIN is going to occur for the PLNRCODE (as you haven't given a table layout). And I would also say that your tables look horrid.... no offense intended. The PARAM and VALUE columns in promo_params make me shudder.
I concur with Littlefoot.