The whole code is part of a stored procedure. I have two pieces of code: This one works fine. On the line this particular code is producing the output: and the other one: This is not working correctly. I get an error: Subquery returned more than 1 value on this line Independently it produces this output: Column and table names
Sql query to select all the sub items in the same table
I have a table in which one column depends another column. The table I have some what resembles the below I need to filter out the Parent Folder Id’s which points out the root folderID 1. And the output should be like the below table: Thanks & Regards, Answer Try below query: dbfiddle Link
SQL query – Return 0 for the column if no record found
I will like to see the specific fields returns with 0 value when there is no record found. Below are my SQL queries that I have tried so far. What it returns is only 1 row as below. Customer Address Number of Lines Date A 3 RF 30-5-2022 But what I expected to see is: Customer Address Number of Lines
Get id with same value
I have a table as below: May I know how can I get the studentNo who have exactly same course as student s001? Many thanks. Answer You want to count the number of courses for each student and then join the table to itself for different students taking the same course with the same total number of courses and then
How to use DateDIFF function in mysql table
I have a dataset in my library management system and I have used below query to get specific field only. now I need DATEDIFF function to get the date difference between today date and ReturnDate if there is no any receiveddate value.Further I dont need negative values as well. As an example if currdate()<ToBEReturnDate the value should be zero(mean that
How to join tables without using join SQL
I’m trying to write a SQL query to grab information from multiple tables and output an end result: a list of all clients that have not placed a stock request yet. Displaying client number will be sufficient. I am not allowed to use inner join or any type of join to achieve this. So far this is what I have
PHP login session not coming through (Login with SQL database)
The latest little ‘challenge’ I’ve made for myself is trying to code a good login screen on a site I’m making for some friends. However, when I input my email and password as they are displayed in my SQL database, the file I use to check it with does not send out anything at all. My code looks as follows:
Hide duplicate column cells in view
First of all, this here doesn’t solve my problem at all. I tried this too. I want generate random unique fake data (first name and address) I used the following SQL request: The result apparently looked like this (the addresses repeat themselves for the next name too): How do I make the first names AND addresses unique? Please note this
Aggregating or nesting STRUCTs in Big Query SQL
I have the following table: ClientId (Integer) EmailCampaign (String) CampaignDetails (STRUCT) 235 Campaign 32 SentOn: 2020-01-22, Email addresses:2, SuccessRate:1 235 Campaign 22 SentOn: 2021-02-02, Email addresses:2, SuccessRate:0.5 235 Campaign 23 SentOn: 2022-05-11, Email addresses:2, SuccessRate:0.3 235 Campaign 55 SentOn: 2020-11-03, Email addresses:2, SuccessRate:0.9 122 Campaign 22 SentOn: 2022-01-03, Email addresses:2, SuccessRate:0.9 And I would like to process the data in
PostgreSQL: Trigger INSERT INTO SELECT from other table
I’m trying to create a trigger that will add a new row processed entry to a destination table each time a new row is created in the source table. Step 1 Create destination table: Step 2 Create trigger function: ** The Select query inside function work normally when single running. Step 3 Create trigger: The problem is that Trigger does