Skip to content

How to find the sum from value of sql column

I have two tables with following data. studenttbl: feetbl: I need to find below data, but I am not getting balance value of seatno 1006: I am using this SQL query: Please help me with this. Answer This issue is due to INNER JOIN versus LEFT JOIN. When you INNER JOIN youll only get matches between two tables. …

Split String into rows but keep associated data

I’m not real familiar with Split_String and my searches aren’t turning up anything that I can figure out for my case. What I need to do is split a field into rows each time its delimited but then for each new row created, copy the associated columns with that field to those new rows. How data will…

How to display and link two sql tables?

I’m trying to display genres from a “Genre” Table in SQL to my main table I found a way to do it with one item but I cannot find a way to do it with multiple genres I got an error from this and I don’t know how to fix it. My SQL database: Answer Do a LEFT JOIN for

How to make correct query with complicated conditions?

I have this table: I need to select only that band_names which participant set is not changed all time of its existance(date_join == active_years_begin and (date_left is null or active_years_end is null) or (date_left == active_years_end)) ) for all band participants. So here right answer is The Beatles, Wing…

Postgresql OVER

I have data like: id user index 1 aaa 0 2 bbb 0 3 aaa 1 4 bbb 1 5 aaa 2 6 ccc 0 How to get only the latest index of each user ? Like this result id user index 4 bbb 1 5 aaa 2 6 ccc 0 Answer Looks like a simple DISTINCT ON: This will