My query is to Produce a list of Employees who work for the cinema with the cinema number 07 and include the cinema name in the result. Arrange the result in ascending order by employee surname. Name …
Return multiple tables specific to each column
I would like to get a more simple query that runs through all columns of a table and returns the SAME number of tables for EACH column. For example… select distinct a from tbl; select distinct b …
SQL Order by 2 conditions
Let’s say that I have a database, that looks like that: price date hour 12.00 2018-12-11 5 13.00 2018-12-04 2 14.00 2018-12-06 1 15.00 2018-12-11 1 16.00 2018-…
DB2 – Multiple Result-Set Stored Procedure
So first off – I’m not sure if my problem lies with my DB2 code, or with my settings on DBeaver. I have an issue when running the following code where only one result set is being displayed in …
Postgres 10 sql How can I do distinct without all columns
I have this following query that gets the closest cities/town to a certain coordinate that is passed in . It will return a max of 5 records and I only want to do a distinct on city and state . In the …
SQL: Sort rows based on attribute order
I want to sort an the value of an attribute (called position) to the row number of another attribute’s ordering. Example: If I have the following attributes: position, points I’d like to order the …
Include parameters in posgresql assert message
Is there a way to include parameters in PostgreSQL ASSERT messages. Example: do $$ declare c integer; begin c := (select count(*) from pg_database); assert c = 7, ‘not 7!’; assert c …
SQL Server case based off of another column
How could I go about using a case statement to set column final, based on column S? The objective is to use any record that has a final, and also include any records from column S only if S = ‘…
How to group two table with the same columns doing total of a column value
I have two oracle table with the same columns I want to create a query over those two tables doing total by a column : Table 1 : PRODUCTION_SYSTEM_ID CARD_TYPE TOTAL DATE_CREATION ———–…
SQL Hasmany Query select 1
I have two tables which I am trying to query. Stock_Table Stock_Code Stock_Name Physical_Stock Order_Table Order_Date Quantity Stock_Code I’m after all stock records where the physical stock …