All Questions
232 questions
-2
votes
3
answers
119
views
Best way to fix data inconsistency [closed]
If you have a column in your table that contains inconsistent data for destinations, for example some may be "New York", some "New York, USA", "NY", etc. for different ...
0
votes
0
answers
93
views
Using RPATH on nested list in SQL in QueryRecord in NiFi
I have a json
[
{
"orderId": "100",
"orderItems": [
{
"orderItemSeqId": "101",
"externalId": "56789&...
-2
votes
1
answer
63
views
Records that need to be different
I am creating a database for a project. In this project there is a table called 'Bookings' this table has 2 fields called DateOfBooking (which is data type DateAndTime) and TimeOfBooking (which is ...
0
votes
0
answers
60
views
Reading an SQL record and all descendants
What would be the most efficient way to selectively read records from a SQL table, along with all their descendants - i.e., records in other tables with different schemas but of the same database, ...
-1
votes
1
answer
38
views
How to fetch the last row of each mis_dt for each cust_id like the ones highlighted in yellow in the image?
How to fetch the last row of each mis_dt for each cust_id like the ones highlighted in yellow in the image?
0
votes
1
answer
28
views
Pyspark - How to fetch the latest fileid for the same duplicate file
I have a Files table, where after inserting the values into the table, I need to fetch the fileid from the table and append it to a dataframe and write it to Raw_Tables.
The code works fine for ...
-1
votes
1
answer
115
views
How to deal: my 'count' query does not get zero, when records not exist
I have a situation when it's needed to have a row of customer info (name, address, number etc.) and a count of cars he has. Each person are able to have any count of cars (car_name, VIN etc.)
And so i ...
0
votes
1
answer
394
views
transpose bigquery records and concatenate the result as a string and and alternative array
I have the following table.
create or replace table t1.cte1 as
WITH t1 AS (
SELECT 1 as id,'eren' AS last_name UNION ALL
SELECT 1 as id,'yilmaz' AS last_name UNION ALL
SELECT 1 as id,'kaya' AS ...
1
vote
2
answers
148
views
MS SQL - find out if a field exists within another
I have a table that, among its columns, has two particular char columns: "Code" and "Obs".
For example:
Column1
Code
Obs
aaa
123
This customer's code is 123
How do I find this ...
0
votes
1
answer
125
views
Table variable join equivalent in Oracle
I'm given quite a huge table My_Table and a user-defined collection Picture_Arr as an input usually having 5-10 rows declared as:
TYPE Picture_Rec IS RECORD (
seq_no ...
-1
votes
1
answer
194
views
How to write a SQL query on a table with nested record?
I want to know what is the top fruit on 2021-08-15 (completed with highest total price), table below:
product
------------------
id | name
------------------
1 | banana
2 | orange
3 | apple
4 | ...
0
votes
1
answer
48
views
Create table in SQL while renaming fields in a record (BigQuery)
I am trying to create a new table in my datawarehouse, I need to rename the fields.
I am using BigQuery for this
The fields in the base table and their types are as follows:
created STRING
...
0
votes
1
answer
114
views
SELECT-SQL-Statement - Transformation of a single data record with a date period into several single data records per day
I have the following example records in a table that contains records with time periods (Originally import data):
ID
DateFrom
DateTo
Value
1
01.01.2021
03.01.2021
A
2
02.03.2021
06.03.2021
B
...
...
0
votes
1
answer
1k
views
How to work with Records, Struct and Array in bigquery without flattening them
I have a very nested table in Big query. This is just a part of it:
[
{
"mode": "NULLABLE",
"name": "id",
"type": "...
-1
votes
2
answers
187
views
Displaying records where the same value have been mentioned more than 3 times in SQL
How can I find a value that has been mentioned several times in a row.
ID |1_Jan|3_Jan|4_Jan|4_Jan|
12 | 2 | 3 | 2 | 4 |
31 | 3 | 4 | 3 | 1 |
25 | 1 | 1 | 1 | 1 |
26 | 3 | 3 ...
0
votes
1
answer
73
views
SQL Server check for prior record only
I have these columns: type(char), date , price.
I would like to check if the same type's price has not changed in the previous record.
I tried this for start:
SELECT *
FROM table t1, table t2
WHERE t1....
0
votes
1
answer
27
views
query calculation between records
This is a simplified representation :
Suppose I have this query :
SELECT DISTINCT T.Description, T.ParamName, T.SetValue, T.ParamID
which returns this result :
Description
ParamName
SetValue
ParamID
...
0
votes
2
answers
267
views
MySQL Delete all records except latest N for each user
I want to keep lastest N records of each user_id and delete others.
Structure table "tab":
id (auto increment)
user_id
information
If possible, I would like to not delete if a ...
0
votes
2
answers
79
views
trying to get latest record from the data in sql
I am trying to get the latest record using max in my query.
Every week we have entries for 400 outlets and when I tried using Max, it was giving me only today's records, which was like only 90.
I am ...
0
votes
1
answer
266
views
Not getting SQL values from Linked Server (Oracle Database)
I have an Oracle Database, Which is linked to an Microsoft SQL Server, so I can query the server and spool information from the database without worries directly from SQL Server Management Studio. Now ...
-1
votes
1
answer
68
views
seeking SQL join example that removes offending records (row-removing row-cleansing SQL join)
The SQL engine in question is SSMS (SQL Server Management Studio V18.5), although I doubt the version is relevant for this inquiry.
I have a table A that's an information source. Also there's a table ...
0
votes
1
answer
30
views
How to edit and return a Cursor in plpgsql?
I am doing a simple query inside a function, and I need to change the values of this query, but only for information. I don't need to update the table as such. I managed to edit the values but I ...
0
votes
1
answer
19
views
Displaying two records from two different functions in oracle instead of in a single row
I wrote below function that works well. And displays the records
select emp_name,
get_emp_status(emp_id) status_1,
get_emp_name_dept(emp_id) status_2
from employee;
Currently Output is:...
3
votes
2
answers
10k
views
PL/SQL simple select into record variable
I have declared a record variable:
Declare
TYPE WORK_REC IS RECORD(
STRING1 VARCHAR (21),
NUMBER1 NUMBER (05)
);
TARGET_REC WORK_REC;
...
At certain point I get two values that I have to move ...
1
vote
1
answer
41
views
Records not showing results
CREATE TABLE manager (
mgrid INT PRIMARY KEY,
fname VARCHAR2(50),
city VARCHAR2(50)
);
The above is the manager table.
& Below is the code I wrote to get ...
0
votes
1
answer
120
views
SQL: How to consolidate three records into one?
I run a query to produce this.
username | userLastFirst | email | approver1 |department
MMickie | Mouse, Mickie | [email protected] | Doe, John |HR
MMickie | Mouse,...
0
votes
2
answers
3k
views
How to also retrieve row/record count from following DB2 query?
Need to also select the total record count given the following query. How would I go about doing this?
SELECT DISTINCT t.Creator AS TABLE_SCHEMA, t.Name AS Table_Name, c.Name AS COLUMN_NAME,
c....
0
votes
1
answer
52
views
Find some records of results in other table - SQL
I have this code:
select J.JobID, J.Barcode,J.Bsn, FL.RequirementStatus as OverallResult,S.Name as operation_name,
FL.Occurred, R.Name as parameter_name,
FL.LowerTorqueLimit, FL.Torque, FL....
2
votes
1
answer
305
views
Record type comparison with different numbers of columns isn't failing
Why does the following query not trigger a "cannot compare record types with different numbers of columns" error in PostgreSQL 11.6?
with
s AS (SELECT 1)
, main AS (
SELECT (a) = (b) , (a) = (a), (b) ...
1
vote
1
answer
794
views
Self-Joining across nested Records in BigQuery
I'm trying to do some joins/aggregations between nested fields in single table and running into both SQL problems and the "Correlated sub queries that reference other tables are not supported unless ...
0
votes
0
answers
245
views
Postgres - partial matches for composite types in an array
This question follows on from a previous one I had posed here. Once again, consider the following example
CREATE TYPE dow_id AS
(
tslot smallint,
day smallint
);
CREATE SEQUENCE test_id_seq ...
19
votes
3
answers
23k
views
Disable AutoDetectChanges on Entity Framework Core
someone knows how to disable the AutoDetectChanges on EFCore?
I need to do it because I have to make an huge import in my database, and can't find information on web.
Tried this but it's not working:...
1
vote
1
answer
789
views
SQL error 'column "zona" is of type box but expression is of type record'
I'm kind of new to SQL, I have seen similar question to this one, however I was not able to fix my problem just by looking at those solutions.
(working on postgres)
I have a table anomalia:
create ...
-1
votes
2
answers
33
views
SQL Select Data JOIN Filtering Duplicate
I have record on database :
Table Alternative JOIN to Table Evaluation
SELECT a.id_alternative,a.value,a.id_criteria,b.name FROM saw_evaluations AS a JOIN saw_alternatives AS b ON a.id_alternative = ...
0
votes
2
answers
58
views
Increment the Prime Key Field Value Everytime Query Appends Other Fields
In my database named 'ADMS', there exists a table called 'Merit' with fields:
(Index, Merit List Number, Group, OM, AS, AR, FGEI, RFGEI, Session)
Index is the Prime Key with Data Type as '...
0
votes
1
answer
28
views
Trying to validate information based on security rights
Trying to make certain textboxes on my webpage visible based on the rights a user has from a user rights table I have
Here's my stored procedure being called
ALTER PROCEDURE [dbo].[...
1
vote
2
answers
45
views
Mysql - Query to show a single record of two linked tables whose condition is only in one of them
I have two tables linked by the id_factura field.
The 'factura' table generates an id for each sale that is made, can contain several products of the sale table, and also has a field called ...
0
votes
2
answers
553
views
How to resolve the missing or invalid option in oracle database?
SET SERVEROUTPUT on
declare
type emp_record is record
(v_empid emp1.empno % type;
v_ename emp1.ename % type; )
emp_rec emp_record;
v_sal emp1.sal%type;
begin
v_sal:=:v_sal;
...
3
votes
1
answer
739
views
How to turn a variable-length record in postgres into an array?
I'm trying to dynamically create tables and turn their columns into arrays. So I would end up with a table that has just 1 column, of type array. The lenght of the array would be equal to the amount ...
0
votes
1
answer
49
views
Navicat SQL Consol in table, set record=itself/10
UPDATE `kingdom`.`monsterinfos` SET `PlusCps` = `PlusCps`/10
on table monsterinfos how to set all pluscps records to itself/10 on navicat console.
1
vote
0
answers
233
views
Most elegant way to create 'subrecord' type keeping names of columns
So I'm playing with Postgres' composite types, and I cannot figure out one thing. Suppose I want to use subset of columns of certain table, or mix of different columns of several different tables used ...
0
votes
2
answers
107
views
Count the number of records in SQL results before a certain value is reached
Looking to count the number of SQL records until a certain value in one of the table columns is reached. Using Asp /VBscript.
Not sure how to formulate the query.
What I've tried is but of course it ...
0
votes
1
answer
37
views
Compare records of 2 tables with SQL
I have 2 tables with the following structure:
1-Items Table
create table if not exists items
(
id bigserial not null primary key,
group_id integer not null,
description text not null,
...
0
votes
1
answer
206
views
SQL - Left Join return latest record
My current code is:
SELECT
T1.SC,
T2.ACC,
T3.C_IDENT,
T4.TITLE,
T4.MID,
T4.SUR
FROM D_REG.AR_JOINT T1
LEFT JOIN E_BASE.ACC_TRANS T2
ON T1.SC = T2.SC
AND T1.ACC = T2.ACC
AND T2.IDENTIFEIR_END_DATE ='...
0
votes
1
answer
85
views
How can I design SQL tables to allow for storage and retrieval of current and historical entity configuration records?
TLDR: How do I structure SQL for saving/retrieval of entity configuration data with ability to know which configuration is current (active) and with ability to keep and retrieve historical ...
0
votes
2
answers
109
views
Oracle Dynamic PL/SQL from table
Trying to run some dynamic sql to check validations. These validations will be some pattern to check against, stored in a table.
DECLARE
in_table_name VARCHAR2(30) := 'TEST_TABLE';
...
-1
votes
1
answer
690
views
Error updating record: You have an error in your SQL syntax how can i solve it?
i'm new to php and mysql.
i try to update record in my database from a html form.
i have a search page that work and a edit page whit a $_GET in the link where is the id of the element i have to ...
2
votes
2
answers
99
views
Mark differences on record level
A real braintease right here.
I want to mark the transitions between de X1's. So the transition from A -> B, B-> A and B-> C, C-> B.
This is to reduce my dataset to only those records that have a ...
-1
votes
3
answers
49
views
SQL selecting multiple record by different variable
Ok, so I have a table Assignment:
[UserId]
[GroupId]
[UpdatedBy]
[UpdatedAt]
Also, I have a function for returning users from a specific group:
select UserId
from dbo.GetGroupUsers() ggu
where ...