[Solved] SQL, PHP update query

Use the mysql_affected_rows function to find the number of records affected. Please see following code. $record = mysql_query(“update table set a=”$b”, b=’$c’ where id = ‘$id’ “); $total_rows = mysql_affected_rows($conn); echo $total_rows; where $conn is the connection object 0 solved SQL, PHP update query

[Solved] Group by – Each Date summary value [closed]

You were close. You need to move the CASE…END inside the SUM() and drop TRS.DATE from the GROUP BY and ORDER BY. SELECT TRS.ITEM, SUM(CASE WHEN CAST(TRS.DATE AS DATE)=’2022-01-01′ THEN TRS.QTY END) D1Q, SUM(CASE WHEN CAST(TRS.DATE AS DATE)=’2022-01-02′ THEN TRS.QTY END) D2Q, SUM(CASE WHEN CAST(TRS.DATE AS DATE)=’2022-01-03′ THEN TRS.QTY END) D3Q, SUM(CASE WHEN CAST(TRS.DATE AS … Read more

[Solved] Using gridview to display string data vertically in a row

Assuming I understand your need, you could try something like the following: /* Create a mock-up table with sample data */ DECLARE @Data TABLE ( InstrumentID INT, InstrumentType VARCHAR(50), InstrumentNumber INT, NANumber INT, DateTimeFiled DATETIME, [Name] VARCHAR(255) ); INSERT INTO @Data ( InstrumentID, InstrumentType, InstrumentNumber, NANumber, DateTimeFiled, [Name] ) VALUES ( 1625168, ‘ACCOUNTS RECEIVABLE’, 1, … Read more

[Solved] SQL statement for getting top 5

If I understand correctly, you want the top 5 countries that appear the most times in the ads table, and for each one of those countries you want to display its most frequent section. The query below selects the top 5 countries by grouping the ads table by country and ordering the count and uses … Read more