Skip to content
Advertisement

Tag: subquery

count() results without using group by

I am attempting something very similar to last example (Using GROUP BY) on this page: https://thecodedeveloper.com/mysql-count-function/ Referring to the following table of data: The following query: Will produce the following output: Except I want to see the number of employees in each department as well as every user in the table. So I want the output to look like this:

Writing a sub-query using a date clause

So basically I’m trying to write something that prints the customer’s name and area code if they have made a booking within the last 6 months of the current date. My code looks like this (it has to be a subquery, not using join) Yet it doesn’t work, but I can get it to work using a join function, but

MYSQL subquery results columns not as expected

I am trying to build a query that will build a output like this. The output that I go is this I was following the instructions here https://www.mysqltutorial.org/mysql-subquery/ My query is this What I was expecting to happen was the alias ‘patient appt’ to be populated with the data from the nested select statement. I was thinking this would work

MySQL: Join three tables, comparing two values

First of all, I’m an amateur on SQL. Here it is the example. From this three tables I would like to know who are the teachers that make more money than Mike Table1: Table2: Table3: So far I’ve made this: And I don’t know how to keep going because when I run it, an error appears. My expected result would

Advertisement