I have a scenario where certain users must have the rights to update or delete certain records in production. What I want to do put in a safeguard to make sure they do not accidentally update or delete a large section (or entirety) of the table, but only a few records as per their need. So I wrote a simple
Filtering records when a particular event occurs
I have the following dataset that lists payments made onto an account, the type of payment (either a regular payment, interest payment or additional payment) and the date of the payments. ID | …
Generate numbers 1 to 1000000 in MS Access using SQL
I am looking for a simple clean method to obtain the sequence {1, 2, 3, 4, 5, 6, 7,…,1000000} in MS Access SQL. I thought of creating a table with a column that numbers from 1 to 100000 however, this is inefficient. Is there a way of generating numbers 1 to 10000000 in MS Access using SQL? I tried the
How to run a string containing a static SQL query in PostgreSQL?
I have a function which generates a static SQL query and returns it as a string. What I need to do is to run the returned string as if I was typing it directly in psql. Here is a very simplified test case (the true mechanism is far more complicated but the following test case at least shows the idea)
SQL count the length of blocks of identical numbers, while ignoring blocks of changing numbers
CREATE TABLE identicalblocks ( [sortid] int, [product] varchar(57), [changing] int ) ; INSERT INTO identicalblocks ([sortid], [product], [changing]) VALUES (1, ‘product a’, 0), (2, ‘…
Return data only for specific condition SQL Server
I need help on my query to display data only for an specific condition. Here is the query select sv.lookupCode as shipment, tv.materialLookupCode, tv.vendorLotLookupCode, …
Using REGEXP_CONTAINS with a list of substrings
I want to know if its possible to use REGEXP_CONTAINS with a list of substrings from a column in another table. Essentially I will have one table containing a list of substrings that I want to check against and I am using those substrings against the whole set of table names in a dataset. Below is the closest…
Association for the child of the child in ruby on rails
Example of data in User table Expected result in rails console, grandfather.grandchildren and grandmother.grandchildren should return the same group of objects: grandfather = User.first grandfather….
Using ST_ClosestPoint, ST_StartPoint, and ST_EndPoint to find closest object to beginning and end points of lines
I need to find the closest points to either end of a line using geometry from two separate tables. So far I was able to use the following to find the geometry of the end points: SELECT “id”, …
I have a double relation of the id of one table to another table and I need to build a relation with the same id in another table twice
I have this table id subOperation 1 test1 2 test2 3 test3 4 test1,test2 5 test1,test3 I need help, to make a query which gives me the following result id idSubOperation idElement 1 1 1 2 2 2 3 3 3 4 4 1 5 4 2 6 5 1 7 5 3 When I have one “,” I need