Edit Sorry for being unclear in the first post. If the item appears only once, it should also be included. Please, check updated sample table… I have a table of record of sales of each item per day….
Order of the tables in a JOIN
In spark-sql I have a query that uses several tables (both large & small) in Joins. My question is – does the order of these tables matter with respect to query performance ? For e.g. select …
SQL Select Error: “ORA-01722: invalid number” only when number is queried
Other questions about this error message seem to be in situations where an insert is being performed or text is being converted to a number. In my case, when I select by a specific number from …
SQL Query for Search Page
I am working on a small project for an online databases course and i was wondering if you could help me out with a problem I am having. I have a web page that is searching a movie database and …
Is there a way to perform this inner join in sql?
I have a sql database with two tables. The first table is named Workers with columns: id, name and includes values: 1, Mark 2, David 3, Peter The second is named WorkingHours with: id, hours, date …
Using charindex to correct name with two commas
I need to write a SQL Query that updates a field with a proper version of their name. Currently, we store employees as Last Name, First Name, and will be implementing email variables so we can say “…
Can not get sql query to run VBA and keep getting errors 3131 error in from clause and 3067 Query must contain at least one table or query
Trying to run a complicated left join on multiple columns and have results show up but won’t run in VBA. I am a noob on this. I have Tried adding brackets and removed iif statement SELECT DISTINCT ‘…
MySQL Order by id, unless the record has a parent_id
I’m using Laravel (and MySQL of course) to build a pages module, a page can have 1 parent This is my current data, and using order_by=”id” it’s also returned like this. +—-+———–+ | id | …
How to set and use variable in a trigger?
I’m creating a trigger in MySQL that should set a variable and use it to update a table. But i can’t find the right syntax to make this work. This is what i tried: CREATE TRIGGER …
Calculation of rank according to supplier table & sales table
I’m working with SQL Server 2014; I attached a purchase table (from suppliers) and sales table. First, I need to use a sales table based on the rankings from the purchase table, product bought first …