473,395 Members | 1,656 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,395 software developers and data experts.

Creating a single row from two

!NoItAll
297 100+
I have an SQL Query that works very well with one exception... (I guess you could say it doesn't work THAT well). I have it retrieving the information I need, but the data comes back in TWO rows and I need it in one.
Here is my query:
Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.     AssignmentLink.ItemType,
  3.     AssignmentLink.UH,
  4.     AssignmentLink.ItemUH,
  5.     AssignmentLink.AssignmentUH,
  6.     Assignment.UH,
  7.     Assignment.Slug,
  8.     Assignment.StartTime,
  9.     Assignment.Location,
  10.     Assignment.Comments,
  11.     Assignment.Format,
  12.         [User].UH,
  13.     [User].UserName
  14.   FROM 
  15.     [User],
  16.     AssignmentLink,
  17.     Assignment
  18.   WHERE
  19.     AssignmentLink.AssignmentUH = Assignment.UH
  20.   AND
  21.     [User].UH = AssignmentLink.ItemUH
  22.   AND
  23.     Assignment.Slug='CHILD SCARE'
  24.  
The "Child Scare" slug is unimportant, that was for debugging purposes. There is only ONE record in the system (comprised of two rows returned) with Slug='CHILD SCARE'
All of the data I need in the two rows are identical except two fields. The fields are ItemType and UserName.
Can I format the query to return the ItemType and UserName fields from two matching records in a single row?
Oct 11 '16 #1
1 1257
Seth Schrock
2,965 Expert 2GB
Somewhere you have a many-to-one relationship and one of the tables has two records matching the criteria. Without seeing your data and knowing exactly what you want done, I can't be very specific, but what I normally do is to use subqueries to get the values I need as different fields instead of different records. For example, if an assignmentlink record is related to two different assignments, then you would create two subqueries. The first subquery would get the first record and the second subquery would get the second record. You can then display the data all in one record, even though it is coming from two different records.
Oct 18 '16 #2

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

Similar topics

1
by: Satchidanand Haridas | last post by:
Hi, I have created an application using python/wxPython and py2exe. I have associated a certain file extension with this application so that when I double-click the file, my application is...
3
by: serge | last post by:
I have all the scrips to create a database. I have a few questions: 1- I am creating a batch file that it will call many lines like: db2 -td@ -f filename.sql -z output.txt The order i am using...
2
by: Andrea | last post by:
I'm having some difficulty creating a report in Access and I need some suggestions. My company issues "Return Authorizations" when customers need to return products. A customer calls in and we...
8
by: Nanda | last post by:
hi, I am trying to generate parameters for the updatecommand at runtime. this.oleDbDeleteCommand1.CommandText=cmdtext; this.oleDbDeleteCommand1.Connection =this.oleDbConnection1;...
3
by: Bill | last post by:
I have a seating chart web form that has over 50 entry field controls (tables/booths) where I use a DropDownList box to select a single company name from a single large list of organizations (200...
4
by: Cal | last post by:
The Help examples for creating a Registry subkey uses double backslashes between subkeys. The examples for creating a folder use a single backslash. First: Am I right in that double...
13
by: Kevin Walzer | last post by:
Which of the Windows/Unix package builders for Python applications is capable of creating single-file executables? I'm thinking of: 1. py2exe 2. Mcmillan Installer/PyInstaller 3. cxfreeze ...
2
by: ice8595 | last post by:
Hi there, I'm having a little trouble getting this, so please excuse me if my question and description sounds confusing or juvenile. I'm creating a new class called 'Rec'. And essentially I...
3
by: dponce | last post by:
Hello, I need some help, this is what I am trying to accomplish. I have 14 different tables, all the tables have the same colums but different information is recorded in each one. What I am trying...
0
by: oyster | last post by:
you can try jungle ( http://www.suda-chen.biz/?page_id=21 ) also
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...

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.