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.
Tag: mysql
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…
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.
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…
how to combine queries from one table?
I have a table with dates and some data. How can I display data for each month (January, February, March), and also display the amount for three months, the average for three months and the maximum payment in one request? the result should be like this users date pay balance avg(balance) avg(pay) sum(pay) use…
SQL Trigger – Having one is messing up new SQL queries
I am able to manually execute the following code: However, if I try creating a Trigger with the same code as above, I get this error when creating a new user in my database: Can’t update table ‘members’ in stored function/trigger because it is already used by statement which invoked this sto…
WooCommerce sql query to find products with a specific meta key and meta value
I am trying to get products with a custom field with value condition from DB. Custom field is named: “_filtered_product”. I want to get products only with value = 1 This is SQL query I have written. Answer Not sure why you want to write your own sql query for this simple task, while you could use …
How to retrieve data from two MySQL tables with multiple associations
I got these two tables where one table is having multiple foreign keys to the second table. Table rankings Table item One ranking record may have multiple association to item table using first_item_id, second_item_id, third_item_id or forth_item_id fields. I want to retrieve ranking records with the correspon…
Calculate expiry date 3 months from now on MYSQL
So I have been given just the expiry dates for my loyalty cards, I need the query to display all the customers whose card will expire 3 months from the current systems date not hardcoded. Lets say todays 2021-09-30, and the card expiry date for customer1 is 2021-12-12 and the customer2 is 2021-10-18. SO the q…
How to return the number of sets for each date
I am running a query that returns: I need to also return the number of Sets for each date: Answer You may add the count window function to your select clause eg Mysql 8+ Older Mysql Versions You may use variables or aggregates to achieve your count Schema (MySQL v5.5) Query #1 Date Set Data NoSets 2021-07-02 …