how should i implement the job?
Is the database on prem or cloud ?
how can i do that?
Which database is this ?
do you happen to have such example?
Is it mysql database ?
What is the error here ?
When requirement is to perform set of SQL operation with dynamic parameters values.
Also SP is resuable i.e create once and use as many number of time
Output the nationality along with the number of apartments.
Sort records by the apartments count in descending order.
Provide sample data and expected output
Okay wait
Call me
how should i implement the job?
how should i implement the job?
Is the database on prem or cloud ?
cloud (GCP)
Simply create a stored procedure that will take records from last 1 hr and insert it into other table.
Create a job for same that will be executed every hr
Create a job for same that will be executed every hr
How can I do this so if the item_id already exist in the sum_table it will add more units to it and won’t try to insert a new record ?
item_id units_sold
1 5
2 6
and now in the Orders table in the past hour i have those:
item_id user_id
1 746473
2 345344
3 2342342
I want that my new side table will be this:
item_id units_sold
1 6
2 7
3 1
how can i do that?
item_id units_sold
1 5
2 6
and now in the Orders table in the past hour i have those:
item_id user_id
1 746473
2 345344
3 2342342
I want that my new side table will be this:
item_id units_sold
1 6
2 7
3 1
how can i do that?
Which database is this ?
mysql
if exists clause to check if item_id already exists. If yes then update the count.
If not then insert
if exists clause to check if item_id already exists. If yes then update the count.
If not then insert
oh i see, so I do this as part of the stored procedure. do you happen to have such example? if exists update else insert?
Kindly find below high level code syntax for same
IF (SELECT 1 = 1 FROM Tablename WHERE created_on >= last 1 hour) THEN
BEGIN
WITH cte_update as
(SELECT ID, count(*) as cnt
FROM Tablename
WHERE created_on is >= last 1 hour
GROUP BY ID
)
UPDATE tablename set count = tablename.count cte_update.cnt
FROM cte_update
WHERE tablename.ID = cte_update.ID;
END;
ELSE
BEGIN
INSERT INTO Table
SELECT ID, count(*) as cnt
FROM Tablename
WHERE created_on is >= last 1 hour
GROUP BY ID ;
END;
END IF;

Is it mysql database ?
https://stackoverflow.com/questions/10581772/how-to-split-a-comma-separated-value-to-columns
I have a table like this
Value String
——————-
1 Cleo, Smith
I want to separate the comma delimited string into two columns
Value Name Surname
——————-
1 Cleo
If the total purchase amount for the customer is <25000 status=silver, amount between 25000 and 50000 status= Gold, amount>50000 status= Platinum.
b. Write a query that displays customernumber, customername and purchase_status from customers table.
Pls help ..this is not working
What is the error here ?
Unknown column
First of all return type of function should be varchar not int
return(purchase_status) in the end
return(purchase_status) in the end
Yes its there..I have mentioned it after end if statement.
paste the code in pastebin and share the link
Image or screenshot wont help
yes I am interested