Skip to content

Tag: sql

Prevent Duplicate Entries in SQL Application

I have an application that’s running on two different machines. The use of the application is pretty simple, we scan a product and it associates the product_id and creates a Unique_ID that’s auto-incremental. Ex: U00001 then the next is U00002 My problem is while both the machines are running, som…

use sql case statement in a adoquery of delphi

so i want to calculate a sum of a field using adoquery and case statement in delphi ; the code i use is this : but i gest an error message : syntax error operator absent in the expression case when month(DATE_PAI)=1 then sum(MT) else 0 end can any one help me please Answer Try to do : (group SELECT

SQL Select Distinct Top5 with Order By and Where

I have a table where Employees can check assets and each of their checks is recorded in a table. Now I want to extract the 5 last checked Asset_Ids for a given employee. He might have checked the same asset more than once, each check is recorded in a table -EmployeeLog- Basically my table has 3 columns : Empl…

How to convert SQL query in laravel query?

I know this question is not asked in a well manner way,so I am sorry,I have SQL query this one I want to convert it in PHP laravel query form so tried this query but I don’t know SQL and even I am not understanding how I convert it, can someone help just convert SQL query to laravel query? here

how to filter data in sql

I am trying to filter the data according to several criteria, and based on these criteria, the record record number 7 (M08) should not appear because the “NewSiteID” column is not null and does not belong to the number 6, but the problem is that this record appears even though I used the condition…

Selecting last record in plsql

Hello I need to select last record in a table(bill_account_billcycle). After finding it I need to take bill_date column date from last record and need implement inside my cursors’ query. I read rownum max etc but couldnt succeed to implement. I am open to advices. I am going to add a screenshoot of one …

Split large texts into chunks in separate rows

I have a table, where some texts are atrociously big. I want to make sure every row in the query output does not exceed, say, 100.000 characters. How do I do that? Here is a quick sample: Let’s say I want output text column to be less than 10 characters. So, I need this result: It would be even better