Merging multiple sql update statements(Oracle)

I'm not very good at sql and I've tried a few things. What would be the best way to combine these 5 update statements into a single statement considering performance of the code? Would be a great help. Thank you so much! Code: ----------------1 Up...
more »

2017-10-04 12:10 (3) Answers

NVL function in Oracle

I want to select all the data from the table employee and make an inner join with an other table for example: SELECT * FROM EMPLOYEE INNER JOIN Deparment ON Employee.Id_Department = Deparment.Deparment_Id AND NVL('Mathematics', Deparment.Name)...
more »

2017-10-04 08:10 (2) Answers

Turn SQL date red if it's not the current date

I'm creating a simple PHP to do list. I want to turn the date red if it's not the current date. Here's part of my code, with the HTML removed: <?php include "connection.php";?> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST'){ $task = iss...
more »

2017-10-04 06:10 (1) Answers

How to Select a substring in Oracle SQL

say I have a table customer with columns Firstname and lastname I would like to be able to write a query that selects all the customers which has exact lastname and the fuzzy firstname The Substring is returning the values as expected when I run t...
more »

2017-10-03 19:10 (2) Answers

ansi SQL date function in Oracle

I realize I could use a combination of to_char and to_date and what not as a work-around, but I'm trying to figure out why this doesn't work. I am using Oracle 12.1 select '2016-10-01' from dual union all select to_char(2016)||'-10-01' from dua...
more »

2017-10-03 18:10 (1) Answers

Filter by numeric column start with a given number

I'd like to filter my rows based on a numeric column. Problem is that the input is a pattern - for e.g. - a number starting with 2045 or something. I could do this: select * from my_table where num_column like '2045%'; It works but that doesn't le...
more »

2017-10-03 13:10 (2) Answers

Find simple frequency pattern in dates

I have a list of customer payment dates and I'm looking to see if there is a 7/14 day or monthly pattern to the payments, often there is!. The problem is that there can also be intermediate payments of similar value, so just looking at the time betwe...
more »

2017-10-03 10:10 (1) Answers

Compare multiple values in a single column oracle

I want to compare multiple values of a column with a single value of another column.I had tried a lot but it gives me "No row selected" here's my scenario... I have a table Bus_stop_table: Bus_ID(FK) ------STOP_ID 201 -------------------401 201...
more »

2017-10-03 05:10 (1) Answers

Grouping data by name and date ranges

I have data in my oracle table where I have names and date rages as following: Name From To Lopes, Janine 07-Jun-17 16-Jul-17 Lopes, Janine 17-Jul-17 23-Jul-17 Lopes, Janine 24-Jul-17 31-Aug-17 Baptista,...
more »

2017-10-02 17:10 (2) Answers

convert raw query to laravel on nested where

How do I convert this to laravel 5.1 eloquent. $rest_id and $shop_id are variables. WHERE `orderbookings`.`status` = 1 AND ((`shop_customer_details`.`restaurant_id` = $rest_id AND `shop_customer_details`.`shop_id` = $shop_id) OR `orde...
more »

2017-10-02 08:10 (1) Answers

Sort by multiple columns MySQL

I have a table in which I have three fields with data type INT, INT and INT. I want to sort my select query using all these three columns. Sort by ASC if field A <= 10, sort by DESC field2 and sort by ASC field 3. SELECT * FROM table1 WHERE id=u...
more »

2017-10-01 13:10 (1) Answers

stuff function in excel

Is there an equivalent of SQL function STUFF in Excel or Excel VBA? I want exact function shown here with all the parameters, especially parameter length: ...
more »

2017-09-28 09:09 (2) Answers

How to fill combo box in a td of a table

I want to retrieve some data from the database and show them in a table, i need to make one field Order_Status to be as a combo box, its data is filled from another table and to add in the beginning of the combo the result of the row returned from th...
more »

2017-09-27 21:09 (1) Answers

Multiply with Previous Value in Oracle SQL

Its easy to multiply (or sum/divide/etc.) with previous row in Excel spreadsheet, however, I could not do it so far in Oracle SQL. A B C 199901 3.81 51905 199902 -6.09 48743.9855 199903 4.75 51059.32481 199904 6.39 54322....
more »

2017-09-27 20:09 (2) Answers