i have to execute an sql query into laravel controller the query inclueds where caluse in which it compares a field from database which is in datetime type with another field that i get from the blade which has a date type, so i have to convert the database field from datetime type to date type this is my que…
Tag: sql
Duplicate or same record in select query
I tried to execute a select query which I select from the different tables but I still getting duplicate record even I use “DISTINCT”. Below I attached the result from my query. Answer DE_Name is different between 2 rows. So it’s correct. To resolve your problem, just do it However, the root…
IN clause in select query with a subquery
I have a query where I join multiple tables. I would like to filter the results based on the status codes and I also want to get the records that were most recently created. Is the below SQL correct? …
Fix Join table functions or not duplicate values?
So I have a query in NaviCat, it has a part that looks like this: As the Base table has the Identifier Number, but does not contain the Names of the person. It is connected properly and works. However, It is tripling some rows in certain cases. I can get a response back that looks similar to this I would
How to count two different values in the same column and output those counts to two different columns
So I have this code already. select Item, count(WORK_TYPE) AS ‘Capacity Replen’ from WORK_INSTRUCTION where WORK_TYPE = ‘Replen – Capacity’ Group by ITEM Which outputs this: Item Capacity Replen …
set data from a table in itself
So, i have to migrate some data, the query is: SELECT * FROM ldf.vin_EntePublicoLDF WHERE ejr_id = 2019; and i have to take those data but set “2020” I try with: SET vin_EntePublicoLDF.ejr_id = …
How to count consecutive dates using Netezza
I need to count consecutive days in order to define my cohorts. I have a table that looks like: pat_id admin_date —————————- 1 3/10/2019 1 3/11/…
Time difference between rows
In a mysql database (ver.5.7.15) I’ve got the following table named operation_list containing the following data: id (autoincrement integer, primary key), operation_date_time (datetime), operation (…
EDATE comparable in SQL Server? — Next Anniversary Date Calculation
Can someone help me figure out a formula to be used in SQL Server similar to the Excel formula pasted below? =EDATE(date,(DATEDIF(date,TODAY(),”y”)+1)*12) I want to capture the next anniversary date….
Count of files received in the last 30 days split by each day
I am trying to get a count of the number of files my company has received in the past month split up by each day. The example below shows what I want the output to look like. | Date- | | -Received- |…