I want to create table for book chapters where pk will be book_id and chapter_internal_number. I’m not sure how find next free chapter_internal_number value for new chapter insert (chapter can be deleted and it’s chapter_internal_number value should be reused). How to find first chapter_internal_n…
Tag: sql
SQL count number of records in one set of data compared to another and present as a percentage
I would like to count the number of unique records not matching on 2 key variables from Data B compared to Data A and present the result as a percentage of the total unique records in Data B. Data A: …
how to delete first occurrence of each group in sas table?
I have data as follows: ID,date 1,27-08-2020 1,28-08-2020 1,30-08-2020 2,05-08-2020 3,06-08-2020 3,10-08-2020 I have to delete first occurrence for each ID group. so that data becomes ID,date 1,28-08-…
Query for R Machine Learning Services – Filtering Categories in Where Clause
I am trying to run a query in SQL Server using the Machine Learning Services extension. So this is the problem I am having; DECLARE @query NVARCHAR(MAX) = ‘ SELECT CATEGORY1,CATEGORY2 FROM TABLE WHERE …
No value given for one or more required parameters adodb access error
I am trying to assign archival id in my database to the corresponding file number column through an Excel userform. It should find the largest alphanumeric string in the column, and increment it by 1 …
SQL frame a result table from a table by searching its field
I have a table as below. MyTabl Name Main Group3 Xyz Group2 Group3 ABC Group1 Group3 PQR – Group3 I need to frame the result table with the fields. “Name”, “…
How to properly store a file location to a postgresql table?
I am very new to postgresql. I don’t plan to study it fully in-depth right now as I have other priority topics to finish. But now I need to know some basics of postgresql for the perfect completion of …
Combining columns into records for WHERE IN()
First, I am sorry. I do not have control to change how the data is stored, so I have to work with it the way it is. I have some tables in a Pervasive database that looks like this: Records: id | …
Postgres join and count multiple relational tables
I want to join the 2 tables to the first table and group by a vendor name. I have three tables listed below. Vendors Table VendorOrders Table OrdersIssues Table The expected output is to count how many orders belong to a vendor and how many issues belongs to a vendor order. I have the below code but it’…
Generating counts of open tickets over time, given opened and closed dates
I have a set of data for some tickets, with datetime of when they were opened and closed (or NULL if they are still open). We would like to generate a table of data showing the total count of tickets that were open through time, grouped by date. Something like the following: Note that I am not sure about how