Table schema is very simple item, category and date. I would like to query all items for each category but only for MAX date per each category.
Replacing part of a string SQL based on condition
I have a use case in amazon redshift which I have a list of numbers in a column: E.g: 1,2,3,4,5,6 For this use case, the numbers have to be in the same column. Lets say that I want to pass a parameter and remove that number from the list. The thing I try to do is: So basically I try
Unable to query null in datetime column in mysql
select query There are are many entries having NUll as ShippedDate, one of them can be seen in the photo, but when i search for those entries where ShippedDate is NULL is get a empty set. How do i select all having NULL as ShippedDate Answer You use wrong operator, equal not work with null
How to query SQL by month & id to get SUM
I have the table data like: And I want to display asp.net table like: Here is the code to get data by group month and shop code But i don’t know exactly how to display data like image 2 in asp.net html table. Can anyone advise on how to do that in asp.net? Thanks in advance. Answer Create a pivot
SELECT Brand and Model for cars which have been rented in December 2000?
There is a table called Car with columns CarID, Brand, Model, ProdYear, Color and a table Rent with columns RentID, CarID, RentDate, ReturnDate. How to SELECT Brand and Model for cars which have been rented in December 2000? RentDate and ReturnDate are stored in DATETIME format (YYYY-MM-DD) Answer For a simpl…
Query to filter duplicate rows for particular column values
I have below table with given values:- Need query to filter Below ResultSet: I need a single row for a given Parent_code. If there are multiple Parent_code, then I have to look for highest Course_Version, if even Course_version’s are same, then I have to look for course_locale=’en_US’ only. And if even …
Can I combine these two queries into a single query?
Note:AUT_GROUP_ID column in Table CBS_OWNER.AUT_GROUP_MAP is the only factor differentiating both queries. AUT_GROUP_ID IN (20,4,7) —>ONNET AUT_GROUP_ID IN (3,6) —> OFFNET The first query …
Is there an sql script to get the date and time a query was run?
I wondered if anyone can help. I need to get the date and time an sql query was run. I would like the output to be in the following format; YYYY-MM-DDThh:mm:ss Does anyone know what sql to write get …
Oracle regex replace multiple occurrences of a string surrounded by commas
I am looking for a way to replace (remove / replace with ”) a character string in a comma-separated list of values in a column in an Oracle SQL database. For example, suppose I have the following …
Spark SQL to join two results from same table
I have a table called “Sold_Items” like below. And I want to use Spark SQL to get the net sell volumes for each participant. Item Buyer Seller Qty ———————————- A …