I know that my question would be duplicated but I really don’t know how to created sql which return results of sum with multiple join. Tables I have result_summary summary_assembly employees info_product machine query result expected output(when sum by num_lot) All of them were modified from original one because they were non-English, so there would be typo. Here now I
how to use wildcard for a column jsonb type
I have a table (named profile) in my Postgres database, which has 3 columns: ID, Day, Ftfm_profile of type jsonb, I tried to extract the row where the profile name (ftfm_profile->’name’) begins with ‘LFBB’ ( sql: LFBB%) using the wildcard as following: the expected result: I can’t seem to find the solution, thanks for your help Answer One option unnests
How to list last 7 days records in postgresql?
I want to display current date and previous 7 days. the query doesnt work for me. Answer I doubt you have future entry dates. So don’t use between. Instead: Note: If you want to count the current date as a day, then you want interval ‘6 days’.
Limited By Value Postgresql query
I have a couple of rows where values in one column are repeating and I need to get a couple of rows where every value is limited by const. For example, i have this rows (1, ‘a’) (2, ‘b’) (3, ‘a’) (4,’…
How to fix my postgres function syntax to fit a user parameter
I’m trying to make a postgreql function, I’m a little confused on which syntax format to use when I’m passing a select statement that takes in a parameter (this parameter can be a string or a list of …
concatenate timestamp to date
I have set of timestamps: how I can concatenate it to dates? expected: Answer You would cast it to a date and the use distinct to get the distinct dates
Sum two column values on the basis of two name column
I am new to Postgres database. I am given 4 columns homeTeamName, homeTeamGoals, awayTeamGoals, awayTeamName. I want to find out the total goal(homeTeamGoals + awayTeamGoals) scored by each team. the database is as follows I think my solution is wrong. So looking for a better way Answer You can separate the table content as below, and then apply SUM function
How to choose in postgresql rows where amount of one value is bigger than another? [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question how to choose in postgresql rows where amount of one value is bigger
How do I make sure that all rows with the same foreign key have unique names in my PostgreSQL database?
I have a PostgreSQL database with two tables: Team and Project, in a one-to-many relationship. Team has these columns: id name Project has these: id name team_id I’d like to make sure that the projects within a team must have unique names. Projects belonging to different teams should be able to share names without a problem, so UNIQUE doesn’t really
Update partial jsonb field in Postgres 13
can anyone help please optimize SQL request Postgres 13 (jsonb). Need to update the “percent” values inside the Jsonb field with the specified ID This example is working, but it works for a very long time on a large database. https://dbfiddle.uk/?rdbms=postgres_13&fiddle=a521fee551f2cdf8b189ef0c0191b730 Answer I would phrase this as: The logic is quite the same as in your original code, but this