so i have the following case below where if jl name does not have n/a i want it to come from the same column. if there is n/a i want to look into this subquery and find the recent jl name. but if the …
Tag: sql-server-2012
I can’t get rows have NULL on all rows for column zfeaturekey based on zplid and code type?
I work with SQL Server 2012. I have an issue I can’t get rows from table #gen when it has Null only on all rows on zfeaturekey field based on zplid and codetypeid. I need to get rows that have NULL only on all rows ON zfeaturekey, but must be same codetypeid and same zplid . Output: This is the
Counting totals on two separate SQL tables
I have two (identical for this purpose) tables ToDoList DoneList I’m trying to get a count from each of these per [ItemBatch] but not sure if that’s actually possible in one query? Separately I’d just do and assign to variables in the front-end so I could get the following: Is there a query that can give me that entire output
Incorrect syntax near the keyword ‘INNER’ in sql update INNER JOIN
I tried to update some records by joining two tables. but It gives me some syntax errors. Please help me to fix this. Answer The correct syntax in SQL Server uses FROM: Note that I’ve also introduced table aliases so the query is easier to write and to read.
How to find missing data in table Sql
This is similar to How to find missing data rows using SQL? and How to find missing rows (dates) in a mysql table? but a bit more complex, so I’m hitting a wall. I have a data table with the noted Primary key: I have a products table with all products, a countries table, and a calendar table with all
Compare procedure Definition within two databases
We have an instance of Sql Server 2012, In the Instance we have 2 dbs called A and B ( Assume A as production DB and B as Development DB and B is the exact copy of Database A ) suppose For Development Purpose,Some procedure ( Already Existed,Not Newly Created ) definition were changed in database B but not in
Write a SQL query to calculate the balance in a card [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Can you please help me how to calculate the balance for each quarter The data table Script to create the table: Create Table CardTransactions (
How to convert date integer keys into datetime in SQL
after a lot of struggle, I cannot convert datekey (20200430) and timekey (103500) into proper datetime (2020-04-30 10:35:00). I do not have an option of joining on date dimension, the numbers must be …
Grouping shift data by 7-day windows in SQL Server 2012
What I want to do is to calculate the number of shifts and hours worked by each employee in any given 7-day period. In order to achieve this, I need to identify and group ‘islands’ of shifts. Note …
How to select 7 rows or more from select query? even if table is returning less than 7 rows
I want a script that gives me an exact 7 rows. For example, if my table returns only 2 rows then we have to add another 5 rows with all columns contains a null value. But if the table returns more than 7 rows then select all returned rows. Please Help! Answer Create a dummy table with 2 Fields Now