473,568 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sql server Query, having count(*)>1 and order by count(*) desc

229 New Member
Hi, I have this query to get a drop down list and that works fine. The trouble is I need to select another field from the table to give it a where clause but if I try I get an error message.

Expand|Select|Wrap|Line Numbers
  1. SQLQuery = "select tbl.country from tbl group by country HAVING COUNT(country) > 1 order by count(country) desc"
Any pointers would be great
Thanks
Richard
Apr 2 '14 #1
1 2252
Rabbit
12,516 Recognized Expert Moderator MVP
I don't see a where clause or the error message.
Apr 2 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2485
by: vidya | last post by:
Hi, I wrote a stored procdure in SQL Server which calculates some metrics. This procedure always returns only one row with 11 columns of integer values. I ran it in SQL Server Query Analyzer thru a remote machine and it executes the procedure in 5 to 6 seconds. I wrote some ADO.Net SqlDataReader code and it takes 25 seconds to get the...
9
3742
by: Steve Jorgensen | last post by:
Hi all, Frankly, this is such an off-beat thing, I don't know if anyone else here will ever have the same issue. Just in case anyone does, though... I needed to be able to search for the first string in a recordset that is the same as a specified string value, or the one that would be right after that if it doesn't exist. Several...
2
1345
by: Jorge Varona | last post by:
Greetings, I am having a difficult time trying to get my index server query to work. Here's the code: // create a connection object and command object, to connect the Index Server System.Data.OleDb.OleDbConnection odbSearch = new System.Data.OleDb.OleDbConnection();
1
3669
by: sunilkeswani | last post by:
Hi I am still new to access. I want to know how i can build a query which can display results from 4 different columns/fields Like. Field1 Field2 Field3 Field4 1 2 1 0 1 1 0 0
0
6029
by: samui | last post by:
Syntax is ORDER BY column_name ASC|DESC, so your statement: $res = mysql_query("SELECT * FROM EWT WHERE $field='$findit' ORDER BY $orderby DESC;") Ronald :cool:
1
2358
by: wintonsl | last post by:
Would anyone know how to convert this Access Query to SQL Server Query? Format(((+++)/(IIf(>0,1,0)+IIf(>0,1,0)+IIf(>0,1,0)+IIf(>0,1,0))),"Standard") What this query is doing in Access is Averaging numbers that are not equal to 0. If the number is equal to 0, it should not be averaged in. The average is set to 2 decimal places.
4
4147
by: winniewang | last post by:
Hi everyone, Who can help me to translate the SQL Server query to DB2 query? The query were shown as below: CAST( CONVERT( CHAR(2), MonthNumberOfYear) + '/ ' + '1/' + CalendarYear AS DATETIME) Any reponse is appreciated^_^ Thanks! Winnie
3
9049
by: Kunal Desale | last post by:
Hello, I am migrating access queries to SQL Server 2005 Queries. My Access Query Is: SELECT qtrade.intordreftrim AS Expr1, qtrade.extordreftrim AS Expr2, qtrade.intinvreftrim AS Expr3, DLookUp("",""," = " & 4 & "and ='" & & "'") AS InvNoLookup, qtrade.invline AS Expr4, qtrade.accountid AS Expr5, qtrade.descriptn AS Expr6, DLookUp("","","...
8
3697
by: munkee | last post by:
Hi people, Im struggling with this quite hard to explain database query. How would I count only once the (many) occurance of a record within a one to many relationship. I have the following tables: tblCheck: lTableID StaffNumber
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.