I have pretty much the exact same question as logged here Select data from date range between two dates But when I used the solution given it does not work for me. Only difference is that my table has date and time in the one column. So I want to be able to return all values that fall within the
Tag: sql
Get the count of newly published product (today) in WooCommerce [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago. Improve this question I have a WooCommerce site where products are considered as trade/deal. The…
Reduce Duplicate results in SQL query
How can I not have duplicate Lesson Dates for the same Location Name and Lesson Name? Here is my output: Answer Remove the re-joined lesson_1 may help
Renaming index gives error Explicit @objtype id not recognised
I am trying to rename an index and getting an error: Error: Explicit @objtype ‘idx_FinData20’ is unrecognized. I can see both the table and index exist. Then what is the problem Answer First – your syntax is wrong. You need only two arguments, first should be table_name.old_name and second o…
How to split datetime 1 row into 2 or more rows based duration-mysql
How to split 1 row of datetime record into multiple rows by splitting duration based on datetime for every hour Input: Want to cut every hour by exact time by dividing duration Output: Answer You should try this query Here i have assumed that login and logout time have same date. it will give difference in mi…
How can I select rows from database where column Name contains exactly 5 digits
I have a database with some count of rows. They contains information about books. And I need to select books with Name which contain EXACTLY 5 numbers. I tried to select by But result by this query returning books with names which contain more than 5 digits For example, I have some rows (Names of books): To K…
Invalid JSON Text – SQL (Java JSON Object)
I’m putting in JSON into an SQL table (type: json) and it claims something is wrong – but I can’t tell what it’s pointing out directly. Current json I’m trying to input: Yes, it is “json within json” but the code I’m writing is kind of dependent on it being that…
Can we define a GROUP_CONCAT function in PostgreSQL?
I have several lines of SQL code for my legacy database with GROUP_CONCAT statements, as in: In PostgreSQL, I can do the same with: I would like to reuse the old SQL as much as possible. So I need to define a GROUP_CONCAT function that internally calls string_agg. Is this possible? EDIT: The linked question i…
Finding a single element in postgres json array
I have a table that has a Json typed column and I am trying query that table based of values that are contained in that json column. Here is the relevant DDL: Here is what a roles value would look like: I want to be able to perform a query like this: So I’ve tried this: And it is giving
SQL wildcards in PYMYSQL search
I am struggling to put together a simple SQL wildcard search for my Flask application. I am using an HTML form field to run a simple mysql query “WHERE CustomerName LIKE ‘a%’”- https://www.w3schools.com/sql/sql_wildcards.asp – However I am unable to get the right positioning for the se…