I have a query: That returns records such as these: I want to be able to only return records that only have ‘I’ values under Inv_Disp where the Order_Num may or may not be the same. But where if an Order_Num Inv_Disp contains an ‘I’ AND some other value such as ‘CH’ or R…
Using SQL code, i need to create a string that automatically creates the dates between to seperate days
I am creating an automatically updating dashboard for repeating purposes and I need to automatically draw invoice values from our system between certain dates i.e. on Tuesday, the reporting needs to show Mondays invoices. Is it possible to create a string whereby dates are automatically set. So far I have rea…
Exclude ALL rows where the ids are the same, BUT one of the rows with the same ids meets the criteria and other doesn’t
How do I filter out ALL rows where the ids are the same, BUT one of the rows with the same ids meets the criteria and other doesn’t? Current Code: Answer You can try to use aggregate window function, writing your condition which you want to exclude. then filter them. Query 1: Results: If your column id_…
2 ways to use Json_array_elements_text() in PostrgeSQL
Here are two ways to use json_array_elements_text() method. 1st method: SELECT id, json_array_elements_text(json_column) FROM Table 2nd method: SELECT id, json_index.json_column FROM Table T LEFT …
Select the non repeating/Distinct value in SQL
I’m trying to select the record based on the distinct id. When i go for ‘DISTINCT’ it picks the duplicate record and truncates the repeating record and gives me the one left out. How can i SQL to pick …
Query to compare/merge two complex queries
I have two queries: Query #1: get all subscriptions It returns which username has which subscription SELECT S.ScheduleID, C.[Path] ObjectPath, U.UserName, SB.[Description], S.StartDate, S….
In Oracle when do I use the keyword ONLY in a query
I’m going through the Oracle certification course and I’m looking at the examples. The instructor isn’t really talking about when to use ONLY and when not to use ONLY. Is the ONLY keyword used in …
count case with multiple conditions in same row
I need to export data of status from s.status column like select s.name, count(CASE WHEN s.STATUS = ‘Active’ THEN 1 END) AS Active_count, count(CASE WHEN s.STATUS = ‘Expired’ THEN 1 END) AS …
how to convert ulong to rowversion
reference to converting sql server rowversion to long or ulong? i can convert SQL RowVersion to ulong by code: Now, I am faced with a problem, how to convert ulong to byte [8]? I save the value of rowversion to a file, then read it and use it to make the query. the query parameter should be byte[] , not
Oracle | If row not found then output count 0
Given a list of client names (comma separated) I need to find out how many exists in Client table and how many dont. The table and input lists are both huge; here I’m just giving table as an example …