I’m trying to create a view that contains a column with a list of codes. This is the SQL code that I currently have: This creates a view with this column: ?column? code1 code2 code3 As you can see the column name is “?column?” and I would like to change it to a name of my choice. I’ve …
Set Db2 statement terminator using C#
I want to create stored procedures in Db2 using C#. My script looks something like this: create procedure test P1: begin statement1; statement2; statement3; end P1ß To execute the procedures, I use …
Median of three columns (for each row) in Vertica SQL
My table looks like this: Product Length Width Height A 34 22 10 B 40 2 12 I would like to get the longest, second longest and third longest side for each product. For the longest and third longest it was easy, I did it like with GREATEST() and LEAST(). For the second longest for the moment I am doing
Using group by with order in postgresql
Query: It yields this: What I need is to show those “fightEventId”s that have more than 2 CONFIRMED fights. Currently all records are ordered in the right way, so the result I expect is: How do I do this? Every time I try, I get errors or the order is broken. As for the DBMS used in the project, i…
Android Room Query returning null
I am trying to get the values from a DB via Room but it always returns null. It should retrieve the data from DB BalancesCat. Any help? Thanks! This is the DAO Repository ViewModel and the Fragment where I want to retrieve the data Answer This isn’t your problem, but I have to mention, your repository&#…
select data from range of two dates
I want a query for selecting data between two dates (p_startdt,p_enddt) which is given by the user, if there is no input then by default data of last one year will be given as output. I am not able to put case for null or no input Answer Use NVL to handle the case of a NULL value. The following
How to not retrieve duplicate row due to stored procedure
I’ve been using my stored procedure to retrieve events filter by : a date start, a date end, a shopId, a sellerId and customerId. First of all, here the principal structure of my database which causes me the problem : Ticket: Id Reference .. .. 15222 BOOKING56654 .. .. Seller : Id Name .. .. 41 Caty .. …
How to write Criteria Query that checks for multiple values in same column along with other WHERE conditions?
Please convert the following SQL Query to a Criteria Query——— I have the following table PEOPLE- ID Name Code 1 Tom A 2 Harry B 3 Tom C 4 John A 5 Sally C 6 Tom B 7 Tom D The query must return the list of records that satisfies the conditions- Name=’Tom’ AND Code=’A’ …
SQL Filter by dateTime
day is a integer variable. If I set the day value to 1, database is filtering for 24 hours. But if I set the day value to 1, I only want to see the logs of the new day. How can I do that? Thank you for your help. Answer
Avoid unnecessary update in “update or insert” SQL?
Here is Firebird SQL description for update or insert: https://firebirdsql.org/refdocs/langrefupd25-update-or-insert.html And my example If book already exists with id=555 and name=’Good book’ then this command executes update statement anyway and the triggering of update triggers is the only effe…