Skip to content

Tag: sql

Counting totals on two separate SQL tables

I have two (identical for this purpose) tables ToDoList DoneList I’m trying to get a count from each of these per [ItemBatch] but not sure if that’s actually possible in one query? Separately I’d just do and assign to variables in the front-end so I could get the following: Is there a query …

Date Conversion Issues ORACLE SQL

this is going to be a totally newb question but my google-fu isn’t landing me anything timely so I figured I would ask you Trying to do this query: But the predicate column is formatted as such: I’m guessing my TO_CHAR and CAST isn’t sufficient due to the error: Anyone happen to know off the…

Select if exists in another table, with AND condition

I haven’t found the answer to my question specifically even though there are very similar subjects on the same matter. Here is my database (MySQL) : I wish to select links where their SOURCE and TARGET exists in the urls table. I’m guessing subqueries or left join will be the answer, but I can&#82…

call oracle function with parameters

I started to learn pl/sql.I have problem with functions.I created a function like this I want to call this function like this select GET_RANK_INFO(‘12345′,to_date(’10/03/2019′,’dd/mm/yyyy’),null) from dual; but it gives error like that the number of argument types invoked i…

I want to make monthly report from SQL using 3 tables [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I wan…

Count only non duplicate values

I need a query to count only values that aren’t duplicates, is there any way to do this without subqueries or temp tables? If I have a table like this: I can’t use SELECT COUNT(DISTINCT quantity) because it returns 4. (89 | 40 | 32 | 29) How can I return 2? (89 | 32) Answer Use a subquery:

Get total count of duplicates in column

I need a query to count the total number of duplicates in a table, is there any way to do this? If I have a table like this: I can’t use SELECT COUNT(quantity) because it returns 2. (40 | 29) How can I return 5? (40 | 40 | 29 | 29 | 29) Answer Using analytic functions:

Left Join Where Clause (name matching ID from another table)

I want to the output to be the birthday, first and last name of customers who have been served by David who has the employee ID of 1. But for some reason (and it may be obvious, im only a beginner), it only outputs one row of Victor who’s c_id matches e_id (which I know the clue is somewhere there