I have a Xamarin.Forms app which has a ListView. I would like to populate the ListView with the 5 most recent items where the date is today’s date. If there are less than 5 items, the ListView should only display a row for each item (for example, if there is only one item, the ListView should only have …
Get max dates for each customer
Let’s say I have a customer table like so: I want to get 1 row per customer id that has the max(start_date) and if it’s the same date will use the max(created_at). Result should look like this: I’m having a hard time with window functions as I thought a partition by id would work but I have …
Oracle SQL: Get the previous values
I have two columns table: Id, and value. ID Value 1 2 AA 3 4 BB 5 6 7 8 CC 9 I need a query in Oracle to return the result as ID Value 1 2 AA 3 AA 4 BB 5 BB 6 BB 7 BB 8 CC 9 CC Is there anyway to do this? Thanks in
Concatenate or merge many columns values with a separator between and ignoring nulls – SQL Server 2016 or older
I want to simulate the CONCAT_WS SQL Server 2017+ function with SQL Server 2016 version or older in order to concatenate many columns which values are strings like that: Input: Output: Notice that the output result is a new column that concatenate all values separated by ‘|’. The default value sho…
Returning data from XML data in a column in a SQL Server database
Trying to extract data from a column in a SQL Server table. The column however is not of type XML but the data is in XML format (see below). I can extract the data I need via the CAST function, but looking to see if there’s a more efficient query to do so. The data below exists in the details
How to count each value with the same id in sql
I have a table like this How can I get the count of all values with Poll_id = 1 so I can get using sql Answer Use group by with where:
How does SQL subqueries use outside variables
select sName, GPA, sID from Student S1 where not exists (select sName from Student S2 where S2.GPA > S1.GPA) Say the above query. How does the following line work? (select sName from Student S2 …
How do I update my stock database to reduce itself once a customer orders
Time to ask from the almighty stack overflow questions again. So my problem is that I am developing in TKINTER and have implemented and integrated 2 tables in one database on the application. I would …
SQL Report Builder: Issue with SUM in VarChar Column
I’m back with what is probably a very simple question but (as a SQL newbie) I can’t seem to figure it out. I’m basically running a fairly simple report for a hospital. They want a report that details …
Joining three junction tables
my heads hurt from trying to figure this out! I have three tables -Players -Teams -Games Three junction tables with two columns. -player_teams -teams_games -player_games I need to list all Players who …