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 4 months ago. Improve this question I have a table of data that has the following columns The data is going into a timeclock system. I am ultimately trying to find
Tag: sql-server
Exclude Records Based on Criteria
I need to exclude the record: If a customer bought “Shoe” and “Hat” on the same day, exclude the record with “Hat”. If a customer bought “Shoe” and “Cloth” on the same day, exclude the record with “Cloth”. Here is the sample data: Here are the expected results: Answer Self join to your shoe criteria and make sure it is
How can I return the Maximum Letters for a particular location using SQL?
I have the following table: TicketNumber FullName Type ActionTaken CPZName DateReceived DateResponded A306250992 Robson de Souza letter Re-issue Notice Lannisport 06/09/2022 2022/10/06 10:35:48 A306180194 Rivaldo Vitor Borba Ferreira email Re-issue Notice Lannisport NULL 2022/01/06 12:07:05 A306054145 Ronaldo de Assis Moreira User Note Hold For 14 Days Jurassic Park 06/09/2022 2022/11/06 20:53:16 A307716063 Wayne Mark Rooney email Re-Offer Discount Atlantis NULL
SQL STUFF FOR XML with specific grouping
I’m working in SQL Server 2014, and I have the following simple data, which tracks calling history of users: I need to group the ACTIVITY values into one field, which effortlessly be done using the STUFF FOR XML function: However I need to conditionally group these, on the condition that there was more than a 90 day between the activity
Assign group_id to all linked records in many-to-many table
There are 3 tables in my DB; Table 1 has ‘Collateral’, Table 2 has ‘Loans’, Table 3 is a multi-link table between 1 and 2; let’s call it ‘Loan_Collateral_link’. A collateral can belong to 1 or more Loans, and a Loan can have multiple Collaterals. What I want to achieve, is create a separate result set (or table) in which
SQL While Loop is Is Printing same ID for Every Record
My resultset has 2958 rows. I’m trying to Loop over the result set and select each row, assigning a new id to it, but each new Id is printing 2958 times. What am I doing wrong and how could I fix this? After the select is correct, I want to use it with the Insert. Answer The main problem in
Update Multiple Values in a SQL query based on row values
Is there a possible way only use SQL Update query to update July Data to August data? E.g. The Value of B in July should be updated to 12. Dimension Key is the primary key and Name is the “durable” key. CURSOR is allowed to use but not preferred. Answer You must join the table to itself to set different
Time Based SQL Injection attack affect all users or just me?
Sorry for asking this silly question but If I found a website which is vulnerable to time base SQL Injection attack. For example I am using (sleep 20) means server will sleep for 20 seconds and then respond me so the server is down for 20 seconds only for me or all the users on website??? Answer Yes, sleep() function
Trying to publish SQL DB on Visual Studio, I keep getting SQL72025 error
I’m trying to publish a database using Visual Studio, the project has no issues plus I downloaded the (Data storage and processing) toolset. Yet I keep getting SQL:72025 error every time I try to deploy the project. SQL:72025: The referenced assembly .DLL is corrupt or invalid. I get the same message if I try to build the project too. Now
How to use min() together with other column in SQL
I am building an application consisting of an SQL backend and several microservices that communicate with this backend. I am trying to get as little data as possible from the database over the wire so I am trying to fetch the exact records so I don’t have to start looping in the application logic. So this is the source table