I can’t really find any answer that fits my question. I need to know how I can be able to use a subquery together with a custom value with the IN Operator in SQL. Here is an example of a query I came up with: This query is meant to show posts only from users in a users’ following table
SQL query print two columns from two tables with count
I have a table with recipies and one with ingredients, and one that connects them. How can I make a query that lists each recipe and the number of ingredients there are in each one? I have tried …
My last upload of data, the timestamp is off by 2 days, how can I fix it?
So I have a table in Snowflake that I uploaded and made the mistake of uploading some data with the incorrect datetime. The first few columns of the table are different json results, that correspond to the date they were fetched. Example: The INSERT was pretty straight forward, I staged the file and inserted …
Is knex.where prone to sql injection attacks?
This is a follow up question to https://stackoverflow.com/a/50337990/1370984 . It mentions knex(‘table’).where(‘description’, ‘like’, ‘%${term}%’) as prone to sql injection attacks. Even a comment …
How can I concat 2 different numbers to look like a decimal but is actually a varchar without losing place in the decimal portion?
I’m trying to calculate Hours and Minutes, but the minutes portion is dropping the leading 0 and it appears the calculation is incorrect. Example, 9.06 is displaying as 9.6 using this query against the values ClockIn 2020-01-07 23:00:53.000 ClockOut 2020-01-08 07:06:52.000 This results in a calculated t…
SQL Query “like” operator error, when the field is null
this query returns 421 records: Now when I implement the “like” operator, it returns 349 records, it is not taking into account the records with the field “invoice_number” in null:
UPDATE based on multiple overlapping conditions
I have a query which essentially transfers a job from one worker to another. The query works fine, but I need to add one additional check: ensure the current job owner (in jobs) is the worker matching @owner and @teamId. This is essentially the condition that I need to add: To the query below: The problem is …
SQL code takes duplicates in, even though I’ve specified it not to
I’ve written the following code: insert into CDB2020.dbo.PartType ( Name, ComponentType_ID ) select a.[Part Type], c.ComponentType_ID from AccessDataMigration_1.dbo.[B-K Data] as a …
Query statement issue , incorrect syntax near WHERE
con.Open(); string query = “INSERT INTO userinfo(username, Name, Phone, Email, Address, Postalcode) values (@username, @Name, @phone, @email, @Address, @postalcode) WHERE username =” + username; …
Putting the results of a query into new table in SQL Server
I want to insert query results into new table is there any way I can make changes in code so that it gets stored in a table. My query: SELECT DISTINCT TOP 5 a.DocEntry ,b.TrgetEntry ,b….