Forum Replies Created

Viewing 15 posts - 1 through 15 (of 17 total)

  • Reply To: Group by Consecutive Months

    Merhaba,

    Sorguyu deneyebilir misin

     

    IF OBJECT_ID('my_table', 'U') IS NOT NULL
    DROP TABLE my_table;

    CREATE TABLE my_table (
    mydate DATE,
    enddate DATE,
    ...

    • This reply was modified 1 month, 1 week ago by  Vedat ÖZER.
  • Reply To: TSQL Pivot Crosstab

    ScottPletcher very nice solution

  • Reply To: TSQL Pivot Crosstab

    Deneyin.

    DECLARE @TBLPERSON TABLE 
    (
    ID INT,
    NAME NVARCHAR(100),
    CONDITION NVARCHAR(100)
    )

    INSERT INTO @TBLPERSON (ID,NAME,CONDITION)
    VALUES ('1','Mary','DrySkin'),('2','Bob','DrySkin'),('3','Mary','Glasses'),('4','Bob','Glasses'),('5','Joe','Glasses'),('6','Mary','GreyHair'),('7','Bob','Glasses'),('8','Mary','Hearing'),('9','Joe','Hearing')

    ;WITH DETAY AS
    (
    select *,ROW_NUMBER() OVER(PARTITION BY NAME ORDER BY ID)...
  • Reply To: T-SQL Query Help

    Sorguyu deneyin.

    select H.*,CASE WHEN H.STATUS = 'completed' THEN '1' ELSE 0 END [Status(1/0)],
    CASE WHEN SAY.DEGER IS NULL THEN 0 ELSE 1 END [FinalStatus]
    from #x1 H
    OUTER APPLY (select...
  • Reply To: simple query question

    If(OBJECT_ID('tempdb..#TBL_Orders ') Is Not Null)
    Begin
    Drop Table #TBL_Orders
    End

    CREATE TABLE #TBL_Orders
    (
    ID INT,
    AMOUNT DECIMAL(19,2),
    Requester NVARCHAR(100)

    )
    INSERT...
  • Reply To: Ask Help to split string by split‘;&;’

    DECLARE @String VARCHAR(50) = 'a=abc;&;b=1;&;c=ddd', @Delimiter CHAR(1) =';'
    SELECT
    SUBSTRING(VALUE,1,CHARINDEX('=',VALUE)-1) ITEMS,
    SUBSTRING(VALUE,CHARINDEX('=',VALUE)+1,9999) AS VALUE
    FROM STRING_SPLIT(@String,@Delimiter) where value <>'&'
  • Reply To: WEB SERVICE DATA RECEPTION

    The code below helped.

    Thanks everyone from Turkey 😉

    DECLARE @URL NVARCHAR(MAX) = 'http://localhost:8091/api/v1/employees/updateemployee';
    DECLARE @Object AS INT;
    DECLARE @ResponseText AS VARCHAR(8000);
    DECLARE @Body AS VARCHAR(8000) =
    '{
    "employeeId": 1,
    ...
  • Reply To: Getting sum of all transactions by month-end

    Merhaba,

    Inceleyin.

     

    DECLARE @BASLAMA DATETIME    ='2020-01-01'
    DECLARE @BITIS DATETIME ='2021-12-31'




    DECLARE @TABLOM TABLE
    (
    LOCATION NVARCHAR(100),
    ITEM ...
  • Reply To: Select with case not included in group by

    Hello,

     

    DECLARE @_MyBase TABLE
    (
    Names NVARCHAR(15),
    CardType INT
    )

    INSERT INTO @_MyBase
    VALUES('A','1'),('B','1'),('C','1'),('D','1')

    SELECT
    NAMES,
    CardType
    ,count(*) as NumberOfRows
    , CASE Names
    WHEN 'A' THEN 'Class 1'
    WHEN 'B' THEN 'Class 2'
    WHEN 'C' THEN 'Class 3'
    WHEN 'D' THEN 'Class...
  • Reply To: seeking for tsql help

    Hello there

    try

     

    SELECT c1,C2,MIN(C3)C3,COUNT(*) SAY FROM stg_tbl AS G
    WHERE exists (SELECT * FROM main_tbl AS F WHERE F.c1=G.c1 AND F.c2=G.c2 AND F.c3=(G.C3))
    GROUP BY c1,C2
    UNION ALL
    SELECT c1,C2,MIN(C3)C3,0 FROM stg_tbl...
  • Reply To: week startdate and enddate

    Merhaba,

    Asagidaki sekilde sanirim istediginiz olacaktir.

     

    DECLARE @BASLAMA VARCHAR(11),@BITIS VARCHAR(11)
    SET @BASLAMA = '01.01.2019'
    SET @BITIS = '31.12.2019'

    ;WITH CTE AS
    (
    SELECT
    CONVERT(DATETIME,@BASLAMA,104) AS Tarih
    UNION ALL
    SELECT
    CONVERT(DATETIME,CTE.Tarih,104) + 1
    FROM
    CTE
    WHERE
    Tarih < CONVERT(DATETIME,@BITIS,104)
    )
    SELECT

    YEAR(Tarih) AS Yil,
    DATEPART(week,Tarih) AS Hafta,
    MIN(Tarih)...
  • Reply To: Find payment trend and payment after notice

    Hi,

    IF EXISTS(SELECT * FROM sys.tables WHERE name='Sample_Data') BEGIN

    DROP TABLE Sample_Data

    END

    GO

    CREATE TABLE [dbo].[Sample_Data](

    [ACCOUNT_NO] [varchar](50) NULL,

    [DATE] [varchar](50) NULL,

    [FLAG] [varchar](50) NULL,

    [AMOUNT] FLOAT NULL,

    [NOTICE_COUNTER] [varchar](50) NULL

    )

    GO

    INSERT INTO [Sample_Data] (ACCOUNT_NO, DATE, FLAG,AMOUNT,NOTICE_COUNTER)

    VALUES

    ('304', '03/22/2019', 'Notice', '0',...

  • Reply To: Find payment trend and payment after notice

    This was removed by the editor as SPAM

  • Reply To: Find payment trend and payment after notice

    This was removed by the editor as SPAM

Viewing 15 posts - 1 through 15 (of 17 total)