Programming

Programming Questions? Ask a Programmer for Answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

Programming

I have the following guest information in a table: RRN Col1

Customer Question
I have the following guest...
I have the following guest information in a table:
RRN Col1 Col2 Col3
1 SMITH/M ***@******.*** ID1
2 SMITH/M ***@******.***
3 MEYERS/A ID2
4 MEYERS/B ***@******.***
5 SMITH/S ***@******.*** ID1
Rows 1,2,5 represent one household with different data in 3 columns that identifies them as a single household. Rows 3,4 represent another household with different data in 3 columns that identifies them as a unique househould.
I need to find a way to count the number of households with unique entries in either of the 3 columns.
So, the result of the SQL operation would be 2.
Submitted: 2 years ago.Category: Programming
Show More
Show Less
Ask Your Own Programming Question
Answered in 3 minutes by:
11/26/2015
Programmer: Aitizaz, Software Engineer replied 2 years ago
Aitizaz
Aitizaz, Software Engineer
Category: Programming
Satisfied Customers: 1,291
Experience: 2 Years of experience with VC#,VC++,C,C++
Verified

Hello and welcome to Just Answer! i am Aitizaz and i will assist you today

can you please put this information in a text file with formatting so that i can have a clear understanding of the requirements?

Ask Your Own Programming Question
Customer reply replied 2 years ago
I just posted it. Thx.
Programmer: Aitizaz, Software Engineer replied 2 years ago

OK! let me have a look at it

Ask Your Own Programming Question
Customer reply replied 2 years ago
No worries. I can explain in more detail why the columns can have different information but relate to the same household.
Programmer: Aitizaz, Software Engineer replied 2 years ago

What is the condition to identify different household?

Ask Your Own Programming Question
Customer reply replied 2 years ago
Unique information in any column. For example, rows 1, 2 and 5 are the same household, because 1 of the 3 columns match for those 3 rows.
Programmer: Aitizaz, Software Engineer replied 2 years ago

when do you need this?

Ask Your Own Programming Question
Customer reply replied 2 years ago
What are my options? It would be great to be able to work on the rest of it this weekend. Is it possible to have tomorrow?
I'm in Billings, Montana, USA.
Programmer: Aitizaz, Software Engineer replied 2 years ago

in fact i have a commitment this weekend. i will try to do it as early as possible. can we take it to the next week if i cannot complete that on weekend?

Ask Your Own Programming Question
Customer reply replied 2 years ago
As long as it would be early next week if you can't get to it before hand. I'm using command line SQL so the solution needs to be a single statement, not an SQL procedure. Thx!
Programmer: Aitizaz, Software Engineer replied 2 years ago

Yes i will try to do that as early as possible and as a single statement.Thanks

Ask Your Own Programming Question
Customer reply replied 2 years ago
Aitizaz, any progress on the SQL statement?
Programmer: Aitizaz, Software Engineer replied 2 years ago

i remained busy on the weekend as told you earlier. i will start working on it now and will get back to you soon.

Ask Your Own Programming Question
Programmer: Aitizaz, Software Engineer replied 2 years ago

Don't you think the result of the query should be 3?

Ask Your Own Programming Question
Programmer: Aitizaz, Software Engineer replied 2 years ago

Since MEYERS/A and MEYERS/B are two different records with nothing in common in the rest of the two columns as well

Ask Your Own Programming Question
Customer reply replied 2 years ago
You are correct. I'm sorry -- I gave you bad info. The accurate result is 3. What I was trying to show is that there are three columns that have to be checked and that any of the 3 columns could be used to identify a household. For example, in Row 5, if the Col2 entry was***@******.*** instead of***@******.***, it would match with Row 2 on one entry, thus count as one household. Again, sorry for the confusion in my data example.jef
Programmer: Aitizaz, Software Engineer replied 2 years ago

No problem. i am working on it and as soon as i am successful, i will post the SQL query here.

Ask Your Own Programming Question
Programmer: Aitizaz, Software Engineer replied 2 years ago

can you send me the complete database ( or some portion of it) so that i may apply the query on it?

Ask Your Own Programming Question
Customer reply replied 2 years ago
Aitizaz, not easily. It is on my mainframe, not my PC. Please send me what you have and I'll run it quickly across my guest data set.
Programmer: Aitizaz, Software Engineer replied 2 years ago

i am trying different queries and have not been able to get the exact result as yet. but i am working and will intimate you shortly

Ask Your Own Programming Question
Customer reply replied 2 years ago
Aitizaz, are you able to develop a solution?
Programmer: Aitizaz, Software Engineer replied 2 years ago

I am out of ideas on this. i will opt out so that any other expert may help you. Thank you very much for your patience.

Ask Your Own Programming Question
Customer reply replied 2 years ago
Will somebody else pick this up automatically or do I submit the question again?
Programmer: Jason Carlamere,
 replied 2 years ago
Jason Carlamere
Category: Programming
Satisfied Customers: 11
Experience: Technical Director at PNC Financial Services
Verified

Hello - My name is***** see that our previous expert was unable to help you. I will pick up this up and assist you. I see that you are running this in a mainframe - Is this a going against a VSAM file or are you running a query against a database. I think I understand your requirements, and you are looking for a SQL query correct ?

And just so I am clear on my understanding - your example data would return to you 5 correct ? All rows are unique.

Also - what type of database are you running this against ?

Ask Your Own Programming Question
Customer reply replied 2 years ago
Thanks Jason. Let me know if you have any questions about the SQL statement I'm trying to get. I've asked that it be a single pass SQL statement so it can be executed/run via command line. But, if that is not going to work, I could be open to multi-pass statement where pre-steps build a temp file.
Customer reply replied 2 years ago
PS: Cute picture ... which one is you? Ha!
Programmer: Jason Carlamere,
 replied 2 years ago

I'm the cute one .. :).. I have a question. To help me understand you goal. You say in your initial post that the result should be a count of 2 but I see all 5 rows have unique values when comparing all 3 columns.

Ask Your Own Programming Question
Programmer: Jason Carlamere,
 replied 2 years ago

Are you basing unique if col1 or col2 or col3 are unique.

Walk me through your though process of why 1,2,5 is counted as 1 household.

Wouldn't SMITH/M *****@******.*** ID1 be unique from SMITH/M *****@******.*** and SMITH/S *****@******.*** ID1 ?

Ask Your Own Programming Question
Customer reply replied 2 years ago
The database I'm using is IBM DB2 (IBM i to be specific). Yes, I'm trying to count guest households where col1, 2 or 3 is unique. To provide a little more clarity, Col3 is actually our loyalty card number which may or may not be present depending on when the user buys it. And, what you are seeing is not actual data from our database, it is made up to try to simply represent the data layout where Col1 is our guest name, Col2 is an email address and Col 3 is the loyalty card number.This is a database of transactions where our guests supply the information, meaning I'm dealing with user input and they don't care if they supply easy information for me to count households. So, let's look at records 1, 2 and 5 and why they are the same household.Row 1 and 2 have the same Col1 entry (Name) so they come from the same household -- even though at some point SMITH/M changed his email address from aol to yahoo.com. And at the transaction time of Row 1, SMITH/M had a loyalty card (Col3), but when he stayed with us later, represented by Row 2, he did not have his loyalty card.Row 5 is a transaction where SMITH/M's wife was the main name on the transaction (SMITH/S) -- she even used the household's loyalty card number to tie it in, but she used her old aol account when staying.That is our challenge in SQL: using any of the three columns as unique identifiers to count the number of households in our database. We currently have custom code (not SQL) to do the work, and I'm trying to simplify our ad-hoc reporting of households down to a SQL statement my team can run anytime marketing wants to know.Hope that helps.
Programmer: Jason Carlamere,
 replied 2 years ago

Got it - I have your sample data loaded up in a MySQL database and will get back to you. If I can't come up with anything shortly I will release the question to see if another expert can assist you.

You have a complex problem and I don't know if a SQL query can give you what you need. You will for sure be able to accomplish this with a stored procedure that exists in the database. A stored procedure will give you the ability to perform logic against the data where SQL only allows you to pull data.

I will though try my best to see if a query can be written for this.

Ask Your Own Programming Question
Customer reply replied 2 years ago
Yep, a stored proc will do the job. I've been batting this around for a long time and trying to see if an outside perspective would find a solution for the command line/ad-hoc need I have. Thanks for trying!
Programmer: Ronel Greaves, Software and Systems Architect replied 2 years ago
Ronel Greaves
Ronel Greaves, Software and Systems Architect
Category: Programming
Satisfied Customers: 4
Experience: I have had over 14 years experience in Microsoft Technology stack
Verified

Good morning, do you still need help with this?

If so, I should be able to assist.

Ask Your Own Programming Question
Programmer: Ronel Greaves, Software and Systems Architect replied 2 years ago

I would like to begin by asking -- When you look at the data, how are you personally able to recognize that several rows have the same household?

Once we know that, we should be able to build a query around it.

Ask Your Own Programming Question
Customer reply replied 2 years ago
Ron, thanks, ***** ***** point Jason has taken over the assignment.
jef
Ask ATLPROG Your Own Question
ATLPROG
ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7,677
7,677 Satisfied Customers
Experience: MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

ATLPROG is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,131 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

800 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
Nothing is going on with my computer, but I need some help
Nothing is going on with my computer, but I need some help with excel can you help … read more
Richard
Richard
IT Manager
IT Manager, Consultant
3,281 satisfied customers
My account was seriously hacked. I bought a new phone it was
My account was seriously hacked. I bought a new phone it was so bad. To my surprise they apparently set up a fake FB account. Now I cannot get into my account. The account it keeps pulling up is not m… read more
Pete
Pete
Engineer
Bachelor\u0027s Degree
1,124 satisfied customers
My Microsoft Word and Excel app now require Office 365. They
My Microsoft Word and Excel app now require Office 365. They didn't when I installed the apps. I have them linked to Dropbox files. ???? … read more
Jinsmn
Jinsmn
Systems Administrator
Diplom
1,260 satisfied customers
I am new to word press and downloaded the wordpress.org and
i am new to word press and downloaded the wordpress.org and paid for the business plan and hosted by Bluehost I purchased a theme for Buz theme called the-multiple-pro which they sent a zip file I sep… read more
Chris L.
Chris L.
IT/Web Manager
Vocational, Technical or Trade Scho
29 satisfied customers
I want to pass a csv file twice. The first pass works
I want to pass a csv file twice. The first pass works perfectly: LAreader = csv.reader(open(InFileName,'r')) for line in LAreader: SvcDepNamesSet.add (line[0].strip())When I try a second time, there i… read more
George Sibiya
George Sibiya
PhD
217 satisfied customers
Can I ask you about this question At Olympic diving
Hi Can I ask you about this question At Olympic diving competition level, 10 diving judges award At Olympic diving competition level, 10 diving judges award a single mark (with one decimal place) for … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I have had a mailing list in excel (personal) for years. Can
I have had a mailing list in excel (personal) for years. Can you help me find it so I can update it?? … read more
Sheri
Sheri
Bachelor\u0027s Degree
105 satisfied customers
I need to design an antisense oligo against beta catenin and
I need to design an antisense oligo against beta catenin and HCV-related sequences for clinical use … read more
Kris R
Kris R
IT Manager
Computing
2,654 satisfied customers
I need to know how to create and move a stack of playing
I need to know how to create and move a stack of playing cards in visual basic … read more
Ingo U
Ingo U
Master\u0027s Degree
357 satisfied customers
Write a C++ program to read in various types of test
Write a C++ program to read in various types of test questions (multiple choice and True/False) from a test bank (text file), and load the questions into an array of questions. You will need to implem… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I want to copy a formula horizontally across a row and can't
I want to copy a formula horizontally across a row and can't get it to repeat … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I'm trying to make a python object oriented checkers game,
I'm trying to make a python object oriented checkers game, but I'm lost. I'm trying to find a source code for a python checkers game. Is there any way you would be able to help me … read more
George Sibiya
George Sibiya
PhD
217 satisfied customers
I have a spreadsheet with customer sales and market
I have a spreadsheet with customer sales and market information for the first half of 2017. The list has over 10,000 rows. I added the market segment manually from a drop down menu. Very time consumin… read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
Not sure how to explain this...but I have an excel report
Hi! Not sure how to explain this...but I have an excel report with a field name for first name and one for last name. The report contains multiple people from the same household, one row for each. Eac… read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
Wanting to insert function into a invoice I am building on
wanting to insert function into a invoice I am building on excel, how to add a subtraction … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
How do I get my restored Microsoft Wordpad .rtf files to
How do I get my restored Microsoft Wordpad .rtf files to stop coming up in Landscape orientation. I want them to normally come up in Portrait orientation? (Tech Viet helped me a few days ago.)… read more
Elgin Vega
Elgin Vega
Science Bachellor
104 satisfied customers
I am looking for help understanding the content of some
Hi. I am looking for help understanding the content of some files. Ideally, I could have someone explain what certain things mean so that I am not making assumptions. The files are in HTML, JS, SQL, a… read more
George Sibiya
George Sibiya
PhD
217 satisfied customers
Searching for a tutorial on WordPress theme ColorMag Pro -
Searching for a tutorial on WordPress theme ColorMag Pro - some I have found have no sound and or the narration isn't understandable. … read more
RussellA
RussellA
Solutions Architect
Bachelor\u0027s Degree
123 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x