Skip to content
Advertisement

Tag: sql

Select in return for postgres query

is it possible to add a select in a return statement? I tried adding the select name from skills where skill_id = 1 but not sure if this is possible or I just don’t have the syntax right. Answer Yes, that is possible, but you have to enclose a subquery in parentheses:

Returning Records by Week

I’m trying to come up with a way to return a result set from the below data without a loop that shows the number of records by Team for a particular date range by week. I’ve got a Date table (https://www.mssqltips.com/sqlservertip/4054/creating-a-date-dimension-or-calendar-table-in-sql-server/) that has every day/week/year referenced, but not sure how to connect it up. I’ve got this query: Where it

Get all dates of a Year based on Day Name [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I want to take all Dates of an year based on Day Name. For example If I pass Thu/Thursday and

SQL Server – Add a linked server to AWS RDS instance

From this AWS link it explains how to add a linked server: https://aws.amazon.com/blogs/database/implement-linked-servers-with-amazon-rds-for-microsoft-sql-server/ Specifically these commands The main problem is it seems to be a mix of ‘, `, and ” I get syntax errors, and I assume that’s why. Plus, I don’t know why it has the N before a bunch of them. It looks to me like they

AWS Athena: Unsupported correlated subquery type but it works on Mysql and other flavors

For each order in orders table, I’m trying to return the latest order update value based on time_sent, grouped into a single row. The above select query works fine in MySql but not in AWS Athena. Working MySQL example below: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=66f17cf9f3c8f19f758c7cb1381d8207 Is there a way to accomplish the above using joins? Answer It’s possible to achieve this with Window Functions

how to merge multiple rows into single in MSSQL

this is my data: id segment country product status month year 83916512 Government Null Null Null Null 2014 83916512 Null Germany Null Null Null 2014 83916512 Null Null Carretera Null Null 2014 83916512 Null Null Null completed Null 2014 83916512 Null Null Null Null June 2014 83916512 Null Null Null Null Null 2014 i want below output can anybody help

SQL SERVER Replace Null

I have a tsql query like that: DECLARE @TABLE TABLE( id int primary key identity(1,1), code int ); INSERT INTO @TABLE VALUES (1),(NULL),(NULL),(NULL),(2),(NULL),(NULL),(NULL),(3),(NULL),(NULL)…

Advertisement