Skip to content

Tag: sql

JOIN on two tables

I have two tables: user: and credential: I want to perform a query to get the following result (one row for every user): Right now I am executing this query: This results in: I want a single row for a user. How can I achieve this? Answer You can use two joins:

Count from multiple columns and rows simultaneously in SQL

I have a table of matches which look like: I need to find the total matches played by every team and the output should be like this: I know about SUM() and GROUP BY clauses but not able to do it on multiple columns. Any help would be highly appreciated. Answer You can use union all to unpivot the data

Group data in intervals

I need to group data in intervals of 15 (or X) minutes in sql. For example, i have the next scenario. The result that i expect to obtain is I tried using Lag function but i dont get what i want, because it add interval to each row and continues grouping. Thanks in advance and apologies for my bad english.

Populate all rows of a column with same value

The issue is that I have a PostgreSQL table ‘currency’ with 4 columns: ‘id’, ‘symbol’, ‘name’, ‘quote_asset’. The table contains 225 rows and column ‘quote_asset’ has all the values set to ‘null’ for now (it wasn’t popul…

SUMIFS for vb.net

Good day, How can I do like sumifs in sql query in vb.net here is my code. The plan is to take the Sum of column prdInput based on the helper which is txtlot txtPartnumber and txprocess. I managed to get display the first prdinput the query found but I need the the sum of its since I have multiple