I’ve defined a function CREATE_UUID() to generate UUID. I want to INSERT INTO…SELECT to copy a table but with two new columns with the same value. But doing so will call the function twice with different values. How should I modify this query so that it won’t have different values for two co…
Tag: mysql
MySQL: gets the id instead of the value
I have two tables in my database. Men table: Women table: When I do a inner join, I get: instead of: It gets the id, instead of the partner name. Anyone know what is wrong with my query? Answer
MYSQL: I want to update all rows in a table with values from another table where values from the first table are equal to the second
I am trying to update a damaged WordPress terms relation (in tables wp_terms and wp_term_relationships). Some tags were entered in WordPress with their “term_id” number instead of their “name”, so instead of creating a relation with the original correct tag, a new tag was created with …
Not displaying dates but instead moving them to a different column
Having an issue with a join code where the code is executing but is giving me a warning that it is truncating my PROD_INTO_DATE but I noticed that it was entered into the PROD_CAT_CD column. Where the data is being inserted The PROD_CAT_CD has data that should be there. And where the join is coming from it sh…
SQL bringing two tables into a existing table
I have two different tables and I want to bring over the data onto a single existing table that has columns for the inputs. WHERE ODS_SALE_LARGE contains CUST_NM,CUST_STREET_AD,CUST_POSTAL_CD,CUST_NO,CUST_CITY_NM,CUST_STATE_CD, CUST_PHONE_NO,CUST_BIRTH_DT and ODS_CUSTOMER has CUST_ID,CUST_NO,CUST_INCOME_AM Ho…
SQL : query for multiple conditions with multiple columns
How to query multiple conditions with multiple columns, like AND clause in AND clause. Example data The result that I need is without.. Country = Japan and ZipCode = 1010 Country = Canada and ZipCode = 3030 I try to write SQL like : but it’s not correct. Any help please ? Answer Just use not: You can ex…
MYSQL moving data after distinct
I have data I am pulling from one table to another table but I have a Primary key on the ID column. how do I pull the rest of the data after a Select distinct to make sure I don’t have duplicates in the primary? where I have gotten the distinct store_id from it and inserted into the table but
How do i create a MYSQL database locally using Database folder downloaded from github
I know the above question is incomplete. Let me explain this in brief. I downloaded the repository from this github link https://github.com/datacharmer/test_db and as per instructions on readme file i …
How to return only those customer_id who visited Santa Clara after visiting Milpitas or #5 after visiting #2
Customer_ID Region Location Store_Entry ——————————————————– D1 2 Milpitas ‘2020-10-01’ 14:03 D2 5 Santa Clara ‘…
Compare two results in MySQL [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 1 year ago. Improve this question I want to get an average of Customers total purchase and store it in @x The…