I’m having a question on how to duplicate rows in a table that generates dates between StartDate and EndDate. Actually, I have a same question as this Duplicating records to fill gap between dates in Google BigQuery but with a different type of table. So, my table looks like this: and I would like the o…
Tag: sql
SQL: Filling in Missing Records with Conditional
I need to count the number of products that existed in inventory by date. In the database however, a product is only recorded when it was viewed by a consumer. For example consider this basic table structure: Using the following query, I attempt to determine the amount of products in inventory on a given date…
Select rows which have a field in common with another row
I have two tables: products and postings. A product is a consumer product (ex. iPhone X), and a posting is a listing for a product on an online marketplace (ex. eBay posting). A single product has zero or more associated postings. Is there any way to select only postings which have a “sibling”? ie…
Select duplicated values from one coloum and get there value in one row
i have table with 2 columns like below I want to select all values from table but view it like below: Answer If you’re not trying to create extra columns in your output, you can simply use GROUP_CONCAT with the separator of your choice. For example: Output: Demo on dbfiddle
How do i write this without using ALL?
Write a query to find only those customers whose grade are, higher than every customer to the city New York Answer You can use MAX in your subquery instead: As @GordonLinoff points out, if there are no customers from New York, this query will fail. You can work around that by using COALESCE to convert the MAX…
How to pull the latest records added in a table?
I want to pull the records associated with the latest VERSION_ID. FILE_EXTRACT_VERSION table looks like this: FILE_EXTRACT_VERSION_SPECS table looks like this: I want to write a query to pull records with the latest VERSION_ID (latest can be segregated by the latest date they have been added) Here is what I h…
SQL delete duplicate rows based on multiple fields
I have the following table in sql: id | trip_id | stop_id | departure_time —————————————- 1 | 1| 1| 06:25:00 2 | 1| 2| 06:35:00 3 …
How to handle umlaute like Ä Ö Ü in Coldfusion SQL query to insert into database?
I want to insert a string into my database with Coldfusion. However it contains umlauts like Ä, Ö and Ü (German). The umlauts are displayed different than they should in the database. For example I …
How to combine same result into one row after inner join in LINQ
I’m new in ASP.NET and LINQ. I want to display book name, publisher name, and author name in index page. One book can have more than one author. my query for display the result is like this var …
Calculate differing accumulated storage charges over time?
I am working on a project for a wine importer, in which need to calculate the accumulated storage charges per SKU up to the delivery date. I have data from the warehouse recording the Date_In and …