Skip to content

Get latest child row with parent table row

Two tables posts and comments. posts has many comments (comments has post_id foreign key to posts id primary key) posts id | content ———— comments id | post_id | text | created_at ——–…

Need help in sql Query.neo

In this table there are three colum and in need the value for of data which are lesser than code = 28,this is my query SELECT value,code,date FROM table order by date,vchcode but when i ad where …

Arabic text in sp_sqlexec insert return question mark

Records are imported into table #FileRecords and ##TableInsert are dynamic tables, it can be table A, table B(which justify the reason of using exec sp_sqlexec). When Arabic wording going through sp_sqlexec, it will insert ??? instead of the Arabic wording. Is there anything I am not aware of, beside of encod…

Use multiple but identical aggregate function

I’m trying to use two identical aggregate function is SQL Server, where I use COUNT(A) with some condition and COUNT(A) with another condition. For example I want to count all students enrolled in the course ABC, and the second count I want to count all students who have grade A and have enrolled in the…

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/) th…

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 pas…