How to get the data of a new user

0

My problem is the following one I want to obtain everything that that user of 6 days of antiquity did. I thought so but it does not give me any results and there are transactions within the range put

the slogan is OBTAINING THE TRANSACTIONS THAT THE NEW USER DID, that's why I put the DATEDIFF in the where for me to be old (the condition that I think is that it brings me all the data of the user less than 6 days old)

Any IDEA? thanks in advance!

select TransaccionId, AccountCode, NetAmount, nombreApellido_usuario from TablaPrincipal
left join Usuarios on TablaPrincipal.UserId = Usuarios.Id_usuario
where DATEDIFF(day,Usuarios.fecha_alta,GETDATE()) <= 6

user table

TABLE [dbo].[Usuarios](
    [Id_usuario] [int] IDENTITY(1,1) NOT NULL,
    [username] [varchar](50) NOT NULL,
    [contraseña] [varchar](50) NOT NULL,
    [nombreApellido_usuario] [varchar](100) NOT NULL,
    [email] [varchar](100) NOT NULL,
    [esAdmin] [bit] NULL,
    [fecha_alta] [datetime] NOT NULL,
    [TransactionID] [int] NULL,

Main table

TABLE [dbo].[TablaPrincipal](
    [TransaccionId] [int] IDENTITY(1,1) NOT NULL,
    [AccountCode] [int] NOT NULL,
    [NetAmount] [decimal](18, 2) NULL,
    [EffectiveDate] [datetime] NULL,
    [CreatedDate] [datetime] NULL,
    [DocumentType] [varchar](100) NULL,
    [UserId] [int] NULL,
    [JournalDescription] [varchar](100) NULL,
    [LineDescription] [varchar](100) NULL,
    [Id_movimiento] [int] NULL,
    
asked by Dieguito Weed 08.11.2018 в 19:44
source

0 answers