Skip to content

Check for condition in GROUP BY?

Take this example data: I need an SQL statement that will group all the data but bring back the current status. So for ID 1 the group by needs a condition that only returns the Completed row and also returned the pending rows for ID 2 and 3. I am not 100% how to write in the condition for this.

Remove Duplicate Result on Query

could help me solve this duplication problem where it returns more than 1 result for the same record I want to bring only 1 result for each id, and only the last history of each record. My Query: Result of my query, but returns 3 or 5 identical ids with different histories I want to return only 1 id of

Pivot row values matching a pattern into column names

I have data that look like this: I would like to pivot these data so that for each set of rows with the same OH_IDNR and with the same common/non-unique part of OCV_VNAME, these columns are returned: OH_IDNR The common part of OCV_VNAME (e.g., ‘response_part_0_script_0_’) – n. One column for each …

ORACLE SQL How to use custom function iside insert cte

I am trying to use function inside insert SQL, but I am getting error ORA-32034. Looks like that I couldn’t access this function in the cte. Maybe someone can help? Answer If the query containing the PL/SQL declaration section is not the top level query, the top-level query must include the WITH_PLSQL h…

How to get weekending having all approved records?

I have a table like below now want to get weekending ‘3/1/2020’ since it have all 1’s in isApproved like this I want to get list of weekending having all 1’s in isApproved Answer You can use aggregation and filter with a having clause: This works because isapproved only has 0/1 values.…

Access VBA SQL Update – Too few Parameters expected 1

I am new to access VBA. I am trying to add 1 to all numbers in a field that are equal or greater than the value in text box [TP_Bld_OrderNum_Txt]. This is my code: I get this error: too few parameters expected 1 I believe it relates to the text box value. If I replace Me.TP_Bld_OrderNum_Txt with a number, the