Skip to content

@@ROWCOUNT shows as 0 when deleting using dynamic query SQL

I am facing a trouble when using dynamic query and when trying to get the number of deleted records using @@ROWCOUNT Here is my QUery Here after the dyanimic delete query (inside my cursor) I am trying to store the number of deleted records into another table using @@ROWCOUNT. But it shows as 0. I didnt under…

SQL Server: show string majority

I am looking to make a query in SQL SERVER that will allow me to display in a grouping the string that appears in most cases. Not the amount, not the maximum, but the string that is displayed in most cases: colA colB colC A 10 ccc A 20 aaa A 35 bbb A 25 aaa A 10 aaa B

SQL: Select MAX value from 2 conditions

I have 1 table and 4 columns. I would like to get max value from visit and spending with use condition as max visit first and max spending second. The result should be shown on the YELLOW highlight on Image above. For my code below. Please help me in a better way to do this. Answer This would be the

Select 1 row query insert into multi row

I have existing data like this: Table A Table Master GL: I need to select all row in table A, insert this into below Table B 1 row in Table A will insert into 2 row in table B, also will select the GL code from table Master GL, to get the GL code. Can anyone advise me the query?

REACT: SELECT from MYSQL

i a new user and a new in React world. I need help to solve this situation about a Select with values from mysql DB. I receive the values, but the select goes in infinite loop. The error is surely in this file cause server.js works without problem!! Really thanks for the help, and sorry if it could be a

Retrieve two colums of data with one join

I’m trying to display a list of paired people. I have a link table looking like the following: id user_id_one user_id_two 1 1 2 2 3 4 I wanna retrieve the names linked to these id’s from the main user table looking like: id name 1 jef 2 kevin 3 mike 4 sam I just can’t seem to figure it