Skip to content
Advertisement

Category: Questions

SQL SELECT statement with a many-to-many extra table

I have a table that links users. Consider the following: The user_links table can have 0 rows for a particular user_id, given the user doesn’t have linked users, so a select statement can return either a row or NULL. The approach with left join user_links ul on ul.user_id = contracts.user_id OR ul.linked_user_id = contracts.user_id doesn’t seem to work if there

Add minutes to an Oracle date

I am trying to add minutes to my sql but no error and no data. This is my sql And I want to add 5 minutes to (MO.INSERT_TIME,’DD-MM-YYYY HH24:MI:SS’) So I want my sql show me after 5 minutes for this column (MO.INSERT_TIME,’DD-MM-YYYY HH24:MI:SS’) I wrote sql like that And after 5 minutes I am selecting this sql and their

Converting weight to grams in a SELECT statement

I have a Table called parts which looks like this: Now I want to select the PNO, color,weight and city for “non-Paris” parts with a weight greater than ten pounds. This is not that difficult: Now to the part I don’t understand. How can I add a column to my result which shows the weight converted in to grams (multiplied

Big query/sql to maintain the same data from next row onwards in the same column itself, got based on some condition in the current row

I am working on one of the usecase where I need to implement one of the logic to get the relevant data . eg: If you will see the image : The column = new_TARIFF_ALLOWANCE_DATA is calculated as case when gift_given!=0 or gift_received!=0 then TARIFF_ALLOWANCE_DATA – gift_given + gift_received else remain same whatver it is as per last row calculation

Oracle SQL ignores condition in WHERE clause

I have this simple part of SQL query I have 4 parameters, invoice_num, start_date, end_date and Payee, I want it to be just like a filter, If one of the conditions above is present then it must be applied, if not present then it must be ignored, but it just doesn’t work as expected, if I pass invoice_num the result

Advertisement