Skip to content

How to get unique value in Oracle

My Query: select unique f.documentname,f.projectname,f.documentdescription, f.P0BUSINESSUNIT,f.P0ZONENAME,f.P0REGIONNAME,f.P0GROUPNAME,l.processname, f.ORIGINALCREATIONDATE from p0findoc f, lcstep@…

SQL query for hierarchical number

Here is the data: CREATE TABLE dbo.Correspondents ( ID smallint NOT NULL, ParentID smallint NULL, Name nvarchar(30) NOT NULL, OrderNumber int NOT NULL ); INSERT INTO dbo….

After sorting the rank, how to select one record

I’m working with my database. And I want to sort by download and rank it. After that I want to select one record by id. I know how to rank it. SELECT id, RANK() OVER(ORDER BY “downLoad” DESC)…

Create CHECK constraint SQL

I hope you can help me. I would like to create a check constraint that ensure the column INKOOPBEDRAG has to be higher than PRIJS_PER_D. In the table INKOOPOVEREENKOMST.[BARCODE] it is a FK to ARTIKEL.[BARCODE]. I have created the following CHECK constraint, but I get an error: Answer I solved this using the …

String or binary data of ” would be truncated

I’m trying to resize a column down to 64 characters in length: but I get the following error: String or binary data would be truncated in table ‘dbo.consumption’, column ‘resourceGroup’. Truncated value: ”. This doesn’t make sense to me: how can you truncate nothing? …

select Unique row value in different column value in SQL

I have below table in SQL database with column ‘name’ has same value and column ‘Item’ has different values. table : Name Item A Good A Better A Best I would like achieve below result as output. Result: Name Item 1 Item 2 Item 3 A Good Better Best Answer Pivoting can done using an aggr…