I have departments and issues tables. For every department there are approval levels. So if say HR department has 3 approval levels, i want the drop down to return a new alias column as Y1,Y2,Y3. Similarly if finance has 2 it should return Y1 and Y2. Is it possible in sql? As of now the first alias column is …
Set Sql to Single User mode From C# and Create Admin User
I have a c# winform application which connects to a database and read data. This database is used by another app also. I just executed a query from my app to read some data. I don’t have the user …
Select count(column) from table of mysql in php
I have a database and I am trying to make a website and connect it to my database. I am trying to count the number of instances in a column but I am having trouble. I have this so far: Answer I hope you have the connection done. Here something is column which you are using to filter the output
MySQL query to sum one column and count another column, from two tables, based on a common value?
I’m having issues getting my head around a query that I am trying to build. I’m hoping for a bit of help here… I have two tables. Each table has two columns. They are described as follows: Table: “Token” Table: “Score” I want a query that will list each name once, and…
Update field with a shorter string
I need to modify the LENGTH of text in field in db mysql. I’ve attribute_name that I need to have with max LENGTH 28 characters. WordPress and woocommerce limit this field to 28 characters. Right now my website is down because some taxonomies are too long. There is a way to “cut” all attribu…
Merge Two JSON array columns in Mysql 8
I am using Mysql (version > 8). I have a table where I am storing unique customer ids for the day in an JSON field as an array. I need to query for all unique customers in last 30 days. I am unable to find an equivalent mysql query for the same. I am using JSON_ARRAYAGG to first merge all
Combining some of the rows and sum them up in oracle sql
I`m working on some data manipulation and have table: I need to have and output to look like: Please suggest what can I use to combine and sum up those. I appreciate any input! Thank you Answer You can use aggregation. Values are strings, so you probably want to concatenate them rather than sum them (which ma…
Update next record based on last updated record
I’m struggling to find a solution to update the calculation in the same table based on last updated records order by select column. I have tried LEAD & LAG, but can’t give complete solution of my problem. I tried below query but didn’t succeed. I can use a while loop, but there are more …
Assign a value to a column based on multiple conditions
I have accounting data in SQL. These are entries made for a sale so for every sale made there is an offsetting entry for cost of goods sold as well. In the accounting system we use, it auto generates a transaction id in the TxnId column only for the sales lines not for the cost of goods sold lines for
SELECT value depending on underlying table name
I want to set the value of a column based on the table being queried. Example: Let’s assume two tables: Transportation and Locations. And a SELECT statement with a column named type which shall hold …