Skip to content

Tag: mysql

Mysql how to connect 2 subqueries

I have this mysql code: My code returns 2 different result set in mysql workbench. Is there any way I can connect those 2 result sets? Answer You can use double join clause among three tables : including distinct keyword.

Use select filed result on LEFTJOIN string

I’m trying to use id_program result from the availability table inside a string in LEFTJOIN, is it possible? I tried using this {post.id_program} but its not working. EDIT: http://sqlfiddle.com/#!9/aeb4a7/3 Answer I see two ways.. Using CONCAT(): With REPLACE():

MySQL sum() from more than 1 table

Ok, so every sum() returns the desired value, I already checked it but I’m having problems when trying to sum everything together and then get the total value. Basically I have to do this: initial Fee(which is a set value defined on the”customer” table) + sum of activity1 cost + sum of activ…

I can’t get around INNER JOIN in MySQL

I have two tables in my database. One of which is a table called players and the other one is bans: What I need to do is: select players that where reason = cheating and Score < 250. I tried doing some JOINS when I tried FULL JOIN I found that thing doesn’t exist in MySQL so any help would

efficient way to find last week customer

I have 3 columns(customerid, date_purchased, item) table with 2 weeks of data. I want to retrieve the customers that only bought from the first week. My logic is to find the max date subtract it all the rest of the dates and retrieve customers where that difference equal or less than 7. Here is what I did, bu…

How to identity customer orders by customer IDs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question Say for example I have table Customer and I have another table called orders. How to identif…

MYSQL Query calculate percentage of emails not null

I have these two queries. Caluculates count of emails that are null SELECT COUNT(*) as invalid_email FROM distinct_customers WHERE c_email IS NULL; Calculates count of every email SELECT COUNT(distinct c_number) as total FROM distinct_customers; I am trying to combine those to queries so that it gives me a pe…