I am not an SQL expert and finding this a bit challenging. Imagine I have the following table but with more users: +———+——–+——–+————-+ | user_id | amount | date | …
Getting error while assigning value to collection variable
procedure ins_note (pi_data in note_detail_arr) is begin FOR i IN pi_data.first..pi_data.last loop IF pi_data(i).template_id IN (022, 019, 015, 017, 021, 001, 010, 016, 018, 020, 023) …
How to select elements from 2 differents columns with a common word
I have 2 different columns in the same table, and I want to select lines which contain the word “Hello”. For the first column, I’m using this SQL statement: SELECT * FROM table1 WHERE column1 LIKE …
Get a count of individual instances of a value in MySQL
I have a table with two fields, inbound and outbound, both of which are text values. I want to get all a count of all instances of a specific value in either or both of those columns. Here’s an example of the schema with some values and my query: Here’s an SQL fiddle with the schema and my current query
Single column from Multiple columns from join in SQL
I have a table output like this, which is a result of multiple table joins. I am trying to get a table like this. This is what i am doing currently doing. Not sure how to make the three columns combine to a single column. Answer If you have only one value per row — or if you just want
SQL query to display data in gridview
I have a grid view that displays data from a SQL Server database during page load. My gridview contains these columns: I have used a query: which will display data from SQL Server in the gridview when ReturnedOn column doesn’t have any data. The new query has to satisfy these conditions, It Should not displays a record when Assetype=”Laptop” or
cast VARCHAR2 to LONG,RAW,CLOB and find HASH md5
There is a table A with fields (str1 VARCHAR2(4000 CHAR),str2 VARCHAR2(4000 CHAR)) There is a table B with fields (str1 VARCHAR2(4000 CHAR),str2 VARCHAR2(4000 CHAR),hash_code NUMBER) As a result there is an exception when length(str1||str2) is longer than 4000 (varchar2 is too small). How can I cast this to other type like clob in such select? to_clob(str1 || str2) does not
SQL – How to query values that are greater than the value appeared on the first day of usage?
I have the following (table). I am trying to output all of the incidents of customers that their bill was greater than their first date visiting the restaurant bill the output should be: Tried doing something like that: Any suggestions please? Answer You can use first_value(): You can also use a correlated subquery:
Trying to update where clause to only apply to a certain value
I have a stored procedure in my database. It is a dynamic piece of code and runs for multiple different parameters. Let’s say I have a parameter called @Param that gets passed: 17 (this parameter will be different for different processes). In my query I am attempting to use this parameter to update the WHERE clause like this: Does code
Join Multiple Table based on a condition
I have data where i need to join to different tables based on a condition, month. I am using proc sql. Currently I am using However, this is not working. Any help greatly appreciated. Answer You could do this in a single query, using conditional joins: Note that you should not have several tables to store the same data over