How would I go about getting distinct pairs from a column with a constraint that a pair should not be repeated? So I have a query as such This gets me all possible pairs from that column with a constraint that it cannot pair with it self but this can still happen: (1,2) and (2,1). A pair should never be
Tag: mysql
Find common value from a column where value from separate column matches 3 different values
Apologies for the poorly worded title. I was not entirely sure how to describe the issue. It’s easier illustrated too me. I have a database table that lists content ids and values. One ID can have different values so id = 1 may have 1 or many rows depending on how many values are associated with it. I want to
How to get entries which are grouped and satisfy restriction within the group?
In the table REPORT there are following 3 columns: RID – report id, which is not unique TYPE – can be either new or cancel, report is identified by RID, so one report can have multiple cancellations …
How can I use a calculated value in the WHERE clause?
I have the following SQL: SELECT members.id, FLOOR(DATEDIFF(‘2019-10-25’, crew_cv.dob) / 365.25) as age FROM members JOIN crew_cv ON members.id=crew_cv.user_id WHERE members.active=1 AND age>20 …
How can I join these rows together with commas as a column in my select?
I have the following query: SELECT STRING_AGG(SELECT department FROM additionaldepartments WHERE employee = e.EMPID, ‘,’) AS additional_departments, r.actionId, e.EMPID AS `id`, …
how to convert to_timestamp(’12-10-18 12:00:16.565736000 PM’,’DD-MM-RR HH12:MI:SSXFF AM’) into MySQL
I have one insert query in oracle — Insert into sample (name,time) values (‘RJ-valley’,to_timestamp(’12-10-18 12:00:16.565736000 PM’,’DD-MM-RR HH12:MI:SSXFF AM’)); select time from sample; output …
Convert VARBINARY to Base64 in MySQL
This seems like a basic scenario, but I can’t find relevant info anywhere. I’m new to MySQL, coming from years of Microsoft SQL Server experience. In MySQL, how do you convert a BINARY or VARBINARY value into a Base64 string, and vice-versa? In Microsoft SQL Server, I’ve been using code like this: According to mysql.com, it looks like the TO_BASE64
Insert ordinal number
MySQL 5.7 Consider the following sample data: CREATE TABLE catalog_product_entity_media_gallery ( `value` VARCHAR(24), `entity_id` INTEGER ); INSERT INTO catalog_product_entity_media_gallery (…
does mySQL database work separate from programming languages [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 2 years ago. Improve this question I want to make sure about somethings if I build a project and use SQL database like MySql do I
How to minimize my query to fast the query time in my navicat?
FROM table p WHERE p.column = 0 ) as zxc ORDER BY zxc.column DESC Answer Please try this change-