1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Little help with a SQL query CASE statement

Discussion in 'C#' started by Kyriakos, Sep 14, 2011.

  1. #1

    I'm using a MS SQL Server and some ASP pages for my website. I have this sql query:
    select * from (select distinct extra.utbl01 category,man.name manuf,items.name,items.name1,items.code,
    items.ccctext08,items.code2,items.mtrmanfctr,items.mtrmodel,items.mtrl,items.pricer,items.remarks,extra.bool03,extra.bool04,extra.bool01,ext2.name grcat,ext2.cccname2 encat,isnull(xtrdoc.sofname ,'noImage') as sofname
    from mtrl as items left outer join mtrextra as extra on extra.mtrl=items.mtrl left outer join utbl01 as ext2 on ext2.utbl01=extra.utbl01 left outer join xtrdocdata as xtrdoc on items.mtrl=xtrdoc.refobjid AND XTRDOC.LNUM>0
    left outer join mtrmanfctr as man on items.mtrmanfctr=man.code left outer join dbo.web_limitmtrl as VMQTY on items.mtrl = VMQTY.mtrl left outer join mtrlines as mtln on items.mtrl=mtln.mtrl
    left outer join findoc as fndc on mtln.findoc=fndc.findoc where extra.utbl01='"&cat&"' and mtln.sodtype=51 and fndc.sosource=1351 and (fndc.trnDate>=getdate()-365 or VMQTY.mtrlqty>0 or items.ccctext08=1)
    and extra.bool01=1)t where t.sofname like 'Z:\%' or t.sofname like 'noImage' order by price"
    Code (markup):
    I want to use a CASE statement for this part of query
    if ccctext08=1 then i want to avoid the execution of the above part of SQL query.
    and fndc.sosource=1351
    Code (markup):
    Is this possible?
    Thanks in advance.
    Last edited: Sep 14, 2011
    Kyriakos, Sep 14, 2011 IP