I am working on a stored procedure in snowflake using sql language which expects three parameters. I need to execute different sql queries based on the parameter value of the third parameter. For eg, if the 3rd parameter is A, then execute sql_query1. If 3rd parameter is B, then execute sql_query2 and so on. Is there a way to do
Bind where clause to a column
Input: When Process ID = 610 ID Value 50 2 60 16 // 2 80 128 I have two separate queries that fetch two values from the same table so I am trying to merge them together instaed of calling the table twice. When this is run the where clause applies to [value1] and nothing is set for [value2] I
Dense_Rank does not work as it is expected
I’m creating a query where I need to get the ranking depending on how many are duplicated in the column “MacAddress”(amount) in the table MacsUsers, this is the data: this is my SQL query: I think I’m doing well with the DENSE_RANK function but it does not work as it is expected, any possible solution? thanks advance Answer Your DENSE_RANK
Identifying specific changes via audit table
I have an audit table in a SQL database that is structured like the one below: audit_id id location location_sub location_status dtm_utc_action action_type 2144 2105 9 1 1 2022-09-08 12:36 i 4653 2105 9 1 1 2022-09-08 13:53 u 7304 2105 10 2 2 2022-09-13 15:51 u 7326 2105 11 1 2 2022-09-14 10:06 u I’m trying to write a
How to use INNER LEFT instead of EXCEPT?
I read that MySQL does not support EXCEPT, and the workaround is to use LEFT JOIN. THIS IS MY QUERY: Basically: Trying to find out the manufacturers that sell PCs but not laptops. How can I convert this query with the LEFT JOIN? I got confused.. Table Computers: Table Manufacturers Computers: So since Manufacturer ID number 1 sells Laptop the
SQL dynamic output tables
right now I have 2 tables. The first one has all the sales done by sales persons throughout each week, this table updates every week and only displays the sales of the current week (erases the data and starts over next week), the second table is a record of all sales done ever. SALES FOR THIS WEEK OCTOBER(9 TO 15)(updates
Regex to retrieve dataset and table name using dot in SQL BigQUery
I have an input table which has a list of all queries run in Bigquery. I need to create two columns one with the dataset name and other with table name. The queries example is as follows (some could be nested). I need to separate the dataset name and tablename using the dot in the string Queries dataset table select
How can i use value of a combobox in another external file to help cursor.excute to search in database? NameError: name ‘combo1’ is not defined
I’m having trouble using the combobox in an external file. Basically the combobox is in the main file and I would like to use its selected value in the external file. If I select a certain item, it should help cursor.excute to search for a database table, so cursor.execute(“SELECT x FROM Table1 WHERE element = ?”, (combo1,)) As you can
Condition Based Join in SQL Server
I have the following tables Invoice Organization Customer I’m trying to conditionally join these tables by the following condition: If PTypecd = ‘I’ then data come from the Customer table And if Ptypecd = ‘O’ then data come from the Organization table into the Invoice table. the query i tried so far: How does this condition be used in Join?
Field contains or is equal to another field
I am trying to write a query to return results where “Column B” is equal to or contains “Column A”. I need both, because some fields in Column B are an exact match for field in Column A, and sometimes the value in Column B is the value from Column A with additional characters added on the end. Example Column