Skip to content

Tag: sql

List which has no reports submitted

I have two tables in MySQL database. tbl_sites (similarly around 3500 sites) tbl_reports (Similarly multiple reports from each sites) I want to get the list of sites by site name, where the report count is still zero. A report is considered as successfully submitted when the report_status = 2. Answer Using ex…

How find last number of sequence numbers in sql?

I want find last number of sequence in sql query for fill automatically suggestion field value. forexample my code field(column) is :1,2,3,4,10,20 so i want found 4 in my query Answer If your table is called table_name and looks like this: id 1 2 3 4 10 20 Then this should work: Fiddle

Insert Procedure showing compilation error (Oracle)

I am using Oracle 12c and a certain requirement needs me to prepare an insert procedure. I am not very familiar with procedures so would you please tell me what’s wrong? Table statement: Procedure: I am getting ora-00900 invalid sql statement and ora-24344 success with compilation error Answer I’d…

SQL – combined SELECT queries and getting a % output

I am using SQLiteStudio and I am trying to run the following query. However, it isn’t returning a value. Can anyone help, please? I have been asked to provide some of the data. Below I have included how I created my 3 tables and then some sample data for each section. Hopefully, this is enough but feel …