Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)

  • RE: Procedure Increace by % Using Criteria

    CREATE PROCEDURE AdjustPrice

    (

    @pItemDesc VARCHAR(1000),

    @pPercent NUMERIC(18,2)

    )

    AS

    SET NOCOUNT ON

    BEGIN

    UPDATE Item

    ...

  • RE: Find multiple entries in two fields one table

    select b.isbn,b.title,b.publishername from book b INNER JOIN

    (

    SELECT title, publishername,COUNT(*) count FROM book

    GROUP BY title , publishername

    HAVING COUNT(*)>2

    )t

    on b.title=t.title and b.publishername=t.publishername

  • RE: Exclude duplicate and fetch max of x column

    DECLARE @temptbl AS TABLE

    (

    Field1 INT,

    Field2 INT,

    Field3 VARCHAR(20),

    Field4 VARCHAR(10)

    )

    Insert into @temptbl

    select 32,375,'abc-xyz','A' UNION ALL

    select 32,379,'xyz-efg','A' UNION ALL

    select 55,405,'abc-xyz','B' UNION ALL

    select 55,407,'xyz-efg','B' UNION ALL

    select 132,908,'abc-xyz','C' UNION ALL

    select 132,999,'xyz-efg','C' UNION ALL

    select 152,800,'abc-xyz','D' UNION...

  • RE: Help with group by

    declare @cust table(custID int, name varchar(15))

    declare @order table(orderid int, custid int, orderNum varchar(15),orderdate datetime)

    declare @orderdetail table(orderDetid int, orderid int, itemnum varchar(10),Itemcnt int,amt int)

    insert into @cust(custID,name)

    values (1,'CustOne'),(2,'CustTwo')

    insert into @order (orderid,custid,orderNum,orderdate)

    values...

  • RE: SQL Help

    select * from

    (

    select ROW_NUMBER()over(Partition by coveragecode) rowno,* from Contract

    )t

    where rowno<=5

  • RE: Hierarchial Query

    IF OBJECT_ID('tempdb..#test') IS NOT NULL

    DROP TABLE #test

    ---- create table

    create table #test(sid bigint, scode nvarchar(50), parentid bigint, sname nvarchar(50))

    ---- insert records

    insert into #test values (1, '11', 0, 'a')

    insert into #test...

  • RE: CTE

    Thanks twin.devil

    It works fine

  • RE: CTE

    Incorrect syntax near 'cteReports'.

  • RE: Need unique number for groups of records

    SELECT *,DENSE_RANK() OVER(ORDER BY COL3) 'My Number' FROM MyTable

Viewing 9 posts - 1 through 9 (of 9 total)