Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Posts
    54

    Question Unanswered: What is wrong with this statment

    I apologize for the lack of detail, I'm having more of a problem with my syntax. I keep getting "invalid column name" errors. The invalid column error is coming up on the term "base.DivDesc" in the initial select statement. I'm trying to select the DivDesc from the "base" recordset query.

    select ship.ship_num, ship_dt, ship.from_store_cd , ship.dest_store_cd, store_name,
    store.addr1, store.addr2, store.city, store.zip_cd,
    base.DivDesc, base.ve_cd, gm_sku.sku_num, base.VSN, gm_itm.udf1, base.rqst_qty, base.ret_prc,
    des1, grid_fld_2
    From
    ship, store, ship_ln base, gm_sku, gm_itm, div
    /* (select ship_ln.ship_num, div.des, ship_ln.ve_cd, ship_ln.VSN, gm_itm.udf1,
    ship_ln.ret_prc, ship_ln.rqst_qty,
    gm_sku.sku_num, gm_sku.grid_fld_2, gm_itm.des1
    from ship_ln, gm_itm, gm_sku, div
    Where ship_ln.itm_cd = gm_itm.itm_cd
    and gm_itm.div_cd=div.div_cd and ship_ln.sku_num=gm_sku.sku_num ) base */
    where ship.dest_store_cd = store.store_cd(+)
    and ship.ship_num=base.ship_num(+)
    and base.itm_cd = gm_itm.itm_cd
    and base.sku_num=gm_sku.sku_num
    and ship_tp='STS'
    and (ship_dt>='16-FEB-2004' and ship_dt<='16-FEB-2004')
    order by ship.from_store_cd, ship.ship_num, ship.dest_store_cd, ship_dt, DivDesc, gm_sku.sku_num

  2. #2
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208

    Re: What is wrong with this statment

    Is DivDesc an attribute of table SHIP_LN?

  3. #3
    Join Date
    Oct 2003
    Posts
    54
    DivDesc is a variable column name for the table "div" in that table there are two columns "div_cd" and "des". There is a "div_cd" in the tables ship_ln, gm_itm, and div.

  4. #4
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208
    in your query you reference the column DivDesc with the table alais base.

    Base is an alias of SHIP_LN. Ship_Ln doesn't contain this column. Thus the error.

    so you need to join in the table div and use that to get the des.

  5. #5
    Join Date
    Oct 2003
    Posts
    54
    Aren't we making the connection with:

    "/* (select ship_ln.ship_num, div.des, ship_ln.ve_cd, ship_ln.VSN, gm_itm.udf1,
    ship_ln.ret_prc, ship_ln.rqst_qty,
    gm_sku.sku_num, gm_sku.grid_fld_2, gm_itm.des1
    from ship_ln, gm_itm, gm_sku, div
    Where ship_ln.itm_cd = gm_itm.itm_cd
    and gm_itm.div_cd=div.div_cd and ship_ln.sku_num=gm_sku.sku_num ) base */"


    ...basically the part with:

    "Where ship_ln.itm_cd = gm_itm.itm_cd
    and gm_itm.div_cd=div.div_cd"


    I'm confused...

  6. #6
    Join Date
    Jan 2004
    Posts
    370
    No, because everything between /* ... */ is ignored; it is treated as a comment.
    Last edited by SkyWriter; 02-18-04 at 22:30.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •