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.

2 votes
2 answers
2k views

How can I select a max date from a selection of dates less than another table's max?

Question: How can I select the max(d1_10.dstartdate) (latest unit transfer date) for every xpid (patient ID) from a selection of dates in d1_10 that are less than each xpid's max(d8.start_date) (...
0 votes
1 answer
32 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. ...
0 votes
0 answers
52 views

Get the no.of records Inserted 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?...
0 votes
2 answers
42 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 ...
1 vote
1 answer
31 views

Find records as And in MYSQL

I want find Students id that , must have (professorId = 3 And courseId = 4) And (professorId = 3 And courseId = 2) And (professorId = 5 And courseId = 8). sometime these parenthesis is one or more ...
0 votes
0 answers
5 views

Azure VM: SSRS data driven subscription intermittent error

I have Azure VM database which I use as a source for my DB Source. My SSRS server generates Data Driven report emails out of this db and always have intermittent problems while running my process (...
0 votes
0 answers
14 views

Efficient SQL full data retrieval combining JOINs and WHERE

I have a quite complex data model in my current project's database and I am wondering if there is a better/more efficient way of getting all data, after applying some filters, in a single efficient ...
1 vote
1 answer
2k views

Match java.sql.Timestamp with DB2 Timestamp

I need to pass Timestamp value as parameter in URL to retrieve some data. Format of Timestamp in DB2 is: 2022-05-25-11:10:44.662000, but in java.sql.Timestamp is: 2022-05-25 11:10:44.0 and when I pass ...
1 vote
6 answers
148 views

Parse and split comma-separated fields and expression from a SQL SELECT clause

I've been trying to extract something inside a string. I got the follwing string : *, bob, DATE('gdfgfd', 'Fdsfds', ('fdsfdfsd')), george I want to split by commas outside parentheses and it is ...
0 votes
2 answers
24 views

How to create a Graph based on user input in ORACLE APEX using SQL Queries

I am trying to write an SQL query in Oracle Apex that accesses items in the page and then creates a graph based on that item. In this case, I want to display the last 5 games of a player that the user ...
0 votes
2 answers
2k views

#1227 - Access denied; you need the SUPER privilege for this operation - how to solve?

I am trying to change a SQL Variable through phpMyAdmin, and I get this error: #1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation Trying to solve this ...
1 vote
0 answers
40 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' ...
0 votes
1 answer
17 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 ...
4 votes
2 answers
1k views

How to report on the last day of each month SSRS

What is the best way to run the report every month on the last day in report service web portal? It seems pretty straightforward but I could not seem to find a direct way to do this.
-3 votes
0 answers
22 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 ...

15 30 50 per page
1
2 3 4 5
44872