Skip to content

Tag: mysql

How to call a function and dupe the return value in a SELECT query?

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…

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

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

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…