Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [sql]

Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.

0 votes
0 answers
10 views

SQL Inner join with where clause works fast with one condition, but not when activeFlag is added

I have a query like select C.customerId, C.firstName, C.LastName, R.IsActive from Customer as C Inner join Rider as R ON R.customerId = C.customerid where R.rideid = 'xyz' and R.rideareacode = 'abc' ...
Rancha124's user avatar
-3 votes
0 answers
16 views

Asking for help converting SQL query to EF Core [closed]

I have a working program that uses SQL queries to collect data. I'm working on converting it to EF Core 8. I found an online convert but the result will not compile in my C# project. Can someone ...
herba's user avatar
  • 3
0 votes
0 answers
21 views

Joining tables with different date formats (Literal does not match format string)

I'm trying to join two Oracle tables (basically to pull in a daily rate against the date in another table), but the table I'm pulling the date from has the timestamp in it. I'm seeing a lot of ...
EYU's user avatar
  • 1
0 votes
1 answer
19 views

Accessing deeply nested fields using DuckDB SQL

I have some deeply nested data from a json file and I'm trying to load it into DuckDB: "events": [ { "id": "401638586", "uid": "s:40~l:41~...
Evan Zamir's user avatar
  • 8,349
0 votes
0 answers
40 views

Need to Get the no.of records Inserted in Sql Table in last 10 days

In my table I didn't have primary key and forgot to add timestamp column. Now I would need to find the records with date time of insertion in last 10 days. Is there a way to find this? If yes then how?...
Sumeet Kumar's user avatar
0 votes
1 answer
27 views

How to query for an amount when it changes values base on a record (account#)

I am trying to query for an amount when it changes base on a record. For example the below table. I want to query for the rows with a (****). I want to know whenever the balance changes for each acct. ...
user2654626's user avatar
0 votes
0 answers
11 views

How to add permission to custom role in postgres to create index

I am currently creating a role for a particular database using the below sql script executed as master user (postgres). CREATE USER customrole WITH PASSWORD 'mypassword'; -- removed CREATE ...
Subhajit's user avatar
  • 884
0 votes
1 answer
15 views

How can I rank after filtering inside a window function?

I have a huge BigQuery table "taskperformance" that attributes tasks to sales (ordered in this example for easier understanding): sale_id sale_timestamp task_id task_timestamp is_same_store ...
Etienne Neveu's user avatar
-2 votes
0 answers
48 views

Why am I getting the wrong value or NULL after doing left joins? [closed]

I have a table called Persons with an ID column. I have another table called Cases which has an ID, another PersonID, and the date that the case was made. I have a third table called PersonsCases, ...
Soob's user avatar
  • 1
0 votes
0 answers
12 views

Best practices for improved performance for data retrieval interaction , sql or graphql within flask

Let's say I have three products. one is my database, accessible through SQL , a GraphQL server, and a webApp GUI to access the information of interest. As an example i will say that people around me ...
Corina Roca's user avatar
0 votes
0 answers
45 views

Improve performance or change query so it can be an indexed view

We have this query in a non-indexed view in SQL Server 2022. It's used everywhere and I'm trying to improve the performance. A lot of queries we use elsewhere join to it. My thought was whether there'...
Dave Quested's user avatar
-1 votes
0 answers
39 views

Stored procedure data export double quotes

I created a previous post about double quotes in a query which gave me a good answer but unfortunately I'd have not posted the full stored procedure. I'm having some trouble getting double quotes to ...
Mikano's user avatar
  • 31
-4 votes
0 answers
32 views

Validating rules [closed]

I've a table data:ORG ER |ACT | BUD N |ACT N_1 I identify the cases where I need to identify the ORG ER which will be rejected and I need to insert it in a table of reject. Here the rule 1 that ...
daxnewbie's user avatar
0 votes
2 answers
24 views

Query the lowest sub-value where the main value is grouped

I am trying to create a basis for a list of products in an MS Access Query. The basis must later be used in a form where the products are visualized with only one of the many images associated with ...
Lasse Staalung's user avatar
0 votes
1 answer
38 views

Get all hierarchy in SQL Server

I have a table like this: ID_employee ID_Manager 1 1 2 1 3 1 4 2 5 3 6 5 7 5 8 5 (1 is a boss) What I would like is a result like: ID_employee ID_Manager 8 5 8 3 8 1 7 5 7 3 7 1 6 5 ...
Mr Alsi's user avatar
  • 27

15 30 50 per page