I have the following columns in a table : FDA_ID and FDA_ID_PARENT and the following set of data: FDA_ID | FDA_ID_PARENT 771 | NULL 772 | 771 773 | 771 774 | 0 775 | …
Tag: sql
Select part from the values in SQL
I have such problem/question. I am trying to extract data from database, but only part. The real example is: { “email”:”bla@gmail.com”, “addinfo”:{ “invoice_id”:”1F5FspmpyfQ” }, “…
I need a query in postgres that returns the length of arrays but without taking empty values into consideration
so given the table: id | names =============== 1 {John, , Wayne} 2 {Luke, Harold, } 3 {Bill} 4 {Will, , } They don’t have a standard and some values may come empty ( …
How to delete unnecessary records from postgresql database table
I have a table that includes versions of my table. version_id transaction entity_id date ————————————————————– 1 insert 1 …
Is there an SQL function that let us put condition above WHERE clause?
I have some query with several WHERE clauses. Based on an external variable :flag, I would like to set a condition when I can use a WHERE clause. Below is a presentation of what I mean. There is a …
I have a services table,service has a price, in new order should i save total amount of order or calculate every time services table
do i need to save order amount in orders table or i can calculate everytime from services table against each order ID?
SELECT and SUM in Entity Framework
I want to sum all the columns and where context between dates, basically I want to convert the below SQL query to EF: select meterCategory, sum(cost) maxCost from [dbo].[UsageData] where date …
Get back the id of each insert in SQL Server
Let’s say we want to insert two users and I want to know the userId of each record I inserted. Example: Db: User.lookup database with these columns: UserId(PK, identity) | Username Setup, insert …
Get count and grouping of foreign key
I have this product_user table which has foreign key product in it. I need to group and count all of the products from that table with the same IDs and get that product name so result of the query …
Creating a view (virtual table) which display colums with particular requirements
So I`m trying to make a statistic view which counts various things like how many users are in table called “PACIENTAS” , how many doctors are in table “GYDYTOJAS” and it works. CREATE OR REPLACE …