Skip to content
Advertisement

Tag: select

Order by multiple columns in the SELECT query

How can i order the results in my select query to have them like this? I tried this query but the result is not what I’m looking for: In which col1 represents the first number, col2 is the second one and col3 is the last number in the above example. This query returns: Thanks Answer Sort should be 1-3-2, I’d

Getting values based on other column

I have the following data in SQL. Is there a way using SELECT QUERY that we can replace the NULL values in DATE column based on the REF values? Like replace the NULL values with the first available date for matching REF value, without making any change to the database. Expected Result Answer You can do it with MAX() window

SQL Insert into with join and where

I have three tables. For example: newTable: oldTable: associativeTable: What I want to do now is: I want to move the name column from oldTable to newTable. I have already altered newTable and added an empty name column. Now I’m trying to write a correct INSERT INTO statement. What I have so far is: I’m a bit lost on it.

R : x comparison (1) is possible only for atomic and list types

I am using R. In a previous post (R: Loop Producing the Following Error: Argument 1 must have names), I learned how to make a function (“create_data”) for my code. Now, I am trying to modify this function. First, I create some data to be used for this example: Here is the modified version of the function: The error results

Find two values of one Column based on value of another column per ID

I have a sqlite db with one table that called Loan. This table with sample data is here: Loan Table at sqlfiddle.com This table contains below Columns: Now, I need a query to show desired result, contain [empid],[Codepayid],[Lval-1],[Lval-2],[Sum(Lint)],[Lrmn-1],[Lrmn-2], With this Conditions: For example: Result: EmpID CodepayID Lval1 Lval2 Sum(Lint) Lrmn1 Lrmn2 12450400 649 405480 405485 270320 337900 202740 Answer Use

How to calculate Total transactions amount column with input / output type?

I have two tables : (transactions and Accounts) their columns are as shown in the picture bellow: the Accounts table is simple just two columns ID and account name. The important columns in the Transactions table are Amount and type, the type indicates whether the transaction is an input to the account or an output. I want to find the

Advertisement