UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Data Layout Problem    
 
   
kmillard
post May 4 2012, 01:49 AM
Post #1

New Member
Posts: 3



Hello all,

I have a two tables one which contains personal data about people and another which has a list like this

Fred Bloggs | Fbloggs@email.com| Video 1
Fred Bloggs | Fbloggs@email.com| Video 2
Fred Bloggs | Fbloggs@email.com| Video 5
Fred Bloggs | Fbloggs@email.com| Video 6
Joe Smith | jsmith@email.com | Video 2
Joe Smith | jsmith@email.com | Video 3
Joe Smith | jsmith@email.com | Video 4
Joe Smith | jsmith@email.com | Video 6

And what I need is to join these two table together and produce a report that looks like this

Name | Video 1 | Video 2 | Video 3 | Video 4 | Video 5 | Video 6
Fred Bloggs Yes - - - Yes Yes
Joe Smith - Yes Yes Yes - Yes


Is this possible?

Thanks in advance for any help.
Ken
Go to the top of the page
 
+
RJD
post May 4 2012, 06:42 AM
Post #2

UtterAccess Ruler
Posts: 1,566
From: Gulf South USA



Hi Ken:

(IMG:style_emoticons/default/welcome2UA.gif)

See the demo attached. You might want to include Access version in the future - that is usually helpful. I included an .mdb as well as an .accdb (A2007) in the zip file.

Given your table layout in your post I suspect you might have design issues, but since I don't know any more about your database I'll skip that. And I made up field names since they were not included.

See the query for a method to choose "Yes" if a video number exists and the use of the Totals query approach.

HTH
Joe
Attached File(s)
Attached File  DataLayoutProblem.zip ( 23.83K ) Number of downloads: 7
 
Go to the top of the page
 
+
ace
post May 4 2012, 07:20 AM
Post #3

UtterAccess VIP
Posts: 5,283
From: Upstate NY, USA



Using RJD's demo you could get the same result with a crosstab query.


TRANSFORM IIf(Count(MyTable.Email)>0,"Yes","") AS CountOfEmail
SELECT MyTable.PersonName
FROM MyTable
GROUP BY MyTable.PersonName
PIVOT MyTable.VideoNumber;
Go to the top of the page
 
+
RJD
post May 4 2012, 07:36 AM
Post #4

UtterAccess Ruler
Posts: 1,566
From: Gulf South USA



Hi Ace: If all the video numbers are present, the crosstab is certainly a good way to go. But if a video number is missing - say Video 5 - that will not appear in the crosstab. But it will appear using the Totals approach in my demo. I usually use the Totals approach when there is a limited number of options (video numbers in this case) and I want all options to show in the query even if there are no records for them.

Regards,
Joe
Go to the top of the page
 
+
kmillard
post May 4 2012, 07:47 AM
Post #5

New Member
Posts: 3



Thanks RJD for this excellent answer. I have attached the database as is without the company data - execpt for me!

Would your suggestion work here too. Sorry for such a dumb question.
Attached File(s)
Attached File  bps_cert_status.zip ( 32.01K ) Number of downloads: 2
 
Go to the top of the page
 
+
RJD
post May 4 2012, 08:36 AM
Post #6

UtterAccess Ruler
Posts: 1,566
From: Gulf South USA



Hi again Ken: See if this addition to your database does what you are looking for. See the query: VideosViewedByPersonName. You can, of course, attach any other data by linking the "Org chart" or other table(s).

Also please note that the "OpenText BPS storyline: streaming video" description has two spaces after BPS. I accommodated this in the query, but you might want to recheck how you want that written, and if you take out the space, change the query as well.

HTH
Joe


Attached File(s)
Attached File  bps_cert_status_Fix.zip ( 34.93K ) Number of downloads: 4
 
Go to the top of the page
 
+
kmillard
post May 7 2012, 06:14 AM
Post #7

New Member
Posts: 3



Simply brilliant RJD - thanks.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 05:52 PM