473,383 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

complex problem

rob
Hi all

I have a problem I could use some help with. (I'm new to SQL).

I have a table with 4000+ user details, incuding email addresses. I
need to send out one email per domain except where the domain is an
ISP, or email provider such as hotmail. The best way for me to do
this would be to show all the records where a domain has more than one
email address on it, and then manually go through and delete
superfluous records from the domains which are not ISP's or email
providers.

I need suggestions on how best to tackle this. I've split up the
email column into two seperate columns : username and domain. I've
tried the following :

SELECT count(*) AS num, id, firstname,lastname,username,domain FROM
users
GROUP BY domain HAVING num > 1;

but this only returns one record per domain. I need to return all
records where a domain has more than one email address so I can
selectivly delete the records I don't need.

I'm pretty sure the answer lies in creating a seperate 'domains' table
and setting up a relationship between domains and users, but my
attempts so far have been fruitless.

could anyone point me in the right direction?

thanks
robs
Jul 19 '05 #1
1 1450

"rob" <ro******@hotmail.com> wrote in message
news:31**************************@posting.google.c om...
Hi all

I have a problem I could use some help with. (I'm new to SQL).

I have a table with 4000+ user details, incuding email addresses. I
need to send out one email per domain except where the domain is an
ISP, or email provider such as hotmail. The best way for me to do
this would be to show all the records where a domain has more than one
email address on it, and then manually go through and delete
superfluous records from the domains which are not ISP's or email
providers.
I'm not sure I understand the problem, but...see below.
I need suggestions on how best to tackle this. I've split up the
email column into two seperate columns : username and domain. I've
tried the following :

SELECT count(*) AS num, id, firstname,lastname,username,domain FROM
users
GROUP BY domain HAVING num > 1;


Just "GROUP BY domain". HAVING cannot refer to
I think you'll need to get a little dirty on this if you're not using a
programming/scripting tool.
Just "GROUP BY domain".

<snip>
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marc te Vruchte | last post by:
Over the past years i've been in contact with the same problem a number of times, creating a graphical user interface on complex XML documents. Personally these solutions have never been...
21
by: Blair | last post by:
could someone PLEASE tell me why this doesn't work... ----------------------------------------- #include <complex> using namespace std; typedef complex<long double> cld; void main() { cld...
34
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment...
8
by: Steve Jorgensen | last post by:
Mailing List management is a good example of a case where my conundrum arises. Say there is a m-m relationship between parties and groups - anyone can be a member of any combintation of groups. ...
5
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
12
by: Russ | last post by:
I tried the following: >>> x = complex(4) >>> y = x >>> y *= 2 >>> print x, y (4+0j) (8+0j) But when I tried the same thing with my own class in place of "complex" above, I found that both...
12
by: vj | last post by:
Hi! I have a piece of code (shown below) involving complex numbers. The code is not running and giving error ("Invalid floating point operation" and "SQRT:Domain error"). I would be very...
3
by: Klaas Vantournhout | last post by:
Hi, I am using CLAPACK to do lots of matrix operations, but this is done on complex matrices. There I also need to work with normal complex operators, I use also the standard complex library. ...
1
by: perroe | last post by:
Hi I have a array of complex numbers that are stored in a simple double array. This is done since the array is part of an wrapper for an external C library, and the imaginary part of the first...
9
by: void main | last post by:
I'm rather new to complex numbers in C and was wondering, how do I initialize a complex variable properly if the imaginary part is 0. I tried -------- #include <complex.h> float complex c...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.