Hello I need to select last record in a table(bill_account_billcycle). After finding it I need to take bill_date column date from last record and need implement inside my cursors’ query. I read rownum max etc but couldnt succeed to implement. I am open to advices. I am going to add a screenshoot of one …
Why can’t I sum values for a given period with intervals present in another table?
I’m using a software. I can not change the model. The software is a film rental manager. In the database, I have some clients and differents type of rental and different type of client (free, vip, vip+, …) A client can rent a movie for one day, one week, buy a movie, etc. He starts as a free clien…
Split large texts into chunks in separate rows
I have a table, where some texts are atrociously big. I want to make sure every row in the query output does not exceed, say, 100.000 characters. How do I do that? Here is a quick sample: Let’s say I want output text column to be less than 10 characters. So, I need this result: It would be even better
How do I load values in txt file to mysql table colum
I have value like this stored in value.txt file I have created table in the below way I am unable to find a way to insert the txt file details in payload columnn of table. I saw load option is there but it is more of entire table oriented. I want the txt files value to be in specific column.
In MySQL, query of a word also matches words with special characters
The following query is supposed to match all comments containing ‘testa’, but it matches ‘testä’, as shown below: How to do an exact match only for the string ‘testa’, so that it doesn’t show results for its matching special character? Answer I think I have a solution…
PostgreSQL join table on json property and get oldest first from result with nulls first
I got 2 tables; domains and events. Im trying to create a query that returns a list of distinct domains that is ordered by the oldest events (for that domain) with nulls first and distinct domain. Basically this query will do the job: But the output is not distinct on ‘domain’. When using ‘d…
Rails: Finding records where a nested association is empty
In a Rails application I’m working on, I’ve got a few different models associated like this (condensed for clarity): group.rb group_member.rb newsletter.rb newsletter/author.rb newsletter/story.rb Given the above associated models, here’s the framework I’m working within: Each Newslett…
MySQL – Sum revenue while correcting by daily exchange rates
I have two tables Orders table Exchange rates table (cron-job does the job for this) I have to sum the orders total in USD and with the correct exchange rate! How could I achieve that? Is there a common practice? What I have so far is a basic sum: Answer The link you need is that based on the date.
Oracle query, get count of records by hour
I am trying to get transaction counts for every hour. Normally it is a straight forward query by unfortunately the timestamp column I have to work with is not timestamp but varchar2! No matter what I try I get either “not a valid month” or “invalid number”, depending on the format I us…
Obtain Name Column Based on Value
I have a table that calculates the number of associated records that fit a criteria for each parent record. See example below: note – morning, afternoon and evening are only weekdays What I am trying to achieve is to determine which columns have the lowest value and get their column name as such: Here i…