Skip to content

Trying to assign the value of an SQL Query to a variable SET

I am trying to get date in format yyyymm and then use that date in some operation. ERROR: The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value. Or if I use below: I get same error as above. So I want if today’s date is 17-05-2020, I want 202005 as output and

List a number of copies per book

For a school project, I should do queries on this Library model. I’ve done good so far, but now I’m stuck on this question: “List a number of copies per book”. Here’s what’ve done and not working as …

Using row_number update column value using previous row value

I have a table in hive contents are below Now I want to update the to_d column where row_num > 1 using some conditions like below Please don’t get me wrong I am just trying to help one of the other user’s question Updating column values based on the other table values in hive tables I was tryin…

Unable to get division to work on joined subqueries

I am amalgamating queries I run in MS Access to run on SQL Server and whilst results display OK, I can’t get the division to work (it displays 0) The total seem to calculate OK but as soon as I add …

Understanding use of where in subqueries

List the name and continent of countries in the continents containing either Argentina or Australia. Order by name of the country. From https://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial, question …

Rows not updated in PL/SQL

I want to update user’s salaries in a given department by 10K if they have T in their names otherwise n*10k where n is the saraly category which is from 1 to 5. But somehow Update query is not …

PHP pull SQL as text only

I have a login system that gives users the ability to have profiles. But I noticed if I update my Bio with

it is read and will break the page. Using PHP inside …

Can’t use HAVING clause properly in SQL

I’m having problem with my SQL query. This is my first post, so i’m sorry if the layout isn’t appropriate. I have to filter the grouped results. If there is at least one employee with “MAN” job_id in each row(group in this instance) then the row must be displayed, if there is non…