select country,count() from employee group by country having id<4;
this query works fine but when i use
select country,count() from employee group by country having sex='male';
showing error :-ORA-00979: not a GROUP BY expression
Why??
I'm trying to understand what condition can be placed after the having clause - it is usually a condition, that uses the functions from the select statement, but it also can contain a column, that is typed in the select statement.
Here's an…
Alright so I understand the point of the HAVING clause. I am having an issue and I am wondering if I can solve this the way I want to.
I want to execute one query using ADODB.Recordset and then use the Filter function to sift through the data…
I have to maintain an old MS SQL 2008 database with tons of records. I notice that about 90% are duplicates.
So what is the best way to remove only the duplicates.
I used...
SELECT [Col1],[Col2],[Col3],[Col...], COUNT(*) AS [DuplicateCount]
FROM…
If i'm not wrong when using having, the query is executed without any filters then the code go over all the result to apply the filter. But in this case I'm using multiple Like//If to calculate my order. I was wondering what would be better…
I have a table with columns like this;
site, chromosome, strand.
The pair of site and chromosome should be unique while they can have more than one strand.
Before loading the data, I found that some of the sites have more than one chromosome, which…
I am working on implementation for a SQL which should display results with Union operation between Where and Having Clause.
For example,
Select * from table where col1= 'get' group by col2 (OR/UNION) having avg(col3) >30 . This is not valid but…
This is my first post because I can usually find answers just by browsing the other questions here, but I have tried following instructions on a few of the suggestions, like this, this, this or this, but to no avail.
Ultimately I want to use my…
I have a table with 3 columns: id, sentence and language. So sentences can be either in English and German, IDs are assigned to sentences with same meaning but different languages, like
ID | sentence | language
1 | Hello | en
1 | Hallo |…
I'm struggling to get my query working. Basically, what it should do is only return vacancies that haven't been filled. For example, a vacancy can have a pre-determined limit of 5. To fill this, it will need to have a mixture of 5 active or pending…
I'm trying to use the MAX() function as a subquery to filter results of my greater query by the last couple of whole years. I realized this was a little bit more complicated than what I initially thought it would need so I created a much simpler…
I've looked and looked and tried and tried with no success. I have a query that I use to display users within a certain distance range. It works great, but it returns all users from my users table, and I want it to only return users where the value…
I'm new on Impala, and I'm trying to write a query where one field is SUM(X), and I want to put a condition on that field.
When I used that query in MySQL, "HAVING SUM(X) IS NOT NULL" worked great - does anyone know what's the equivalent in…
I want to select which model car is involved in most accidents.
i am using the following query but i get a syntax error.
please someone tell me whats wrong..
select car.Model
from car
join car_accident_involved
on…