472,374 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Help getting multiple listings

I'm trying this simple query but getting multiple listings for
change_number field

SELECT c.Change_Number, c.Submission_Date, c.Short_Description,
c.CurrentStatus, dlv.Name, s.Description, kw.Subcategory
FROM Changes c
INNER JOIN Deliverables dlv ON c.Deliverable = dlv.DlvID
INNER JOIN Keywords kw ON c.Deliverable_Keyword = kw.KywID
INNER JOIN Status s ON c.CurrentStatus = s.Status
WHERE (c.Application = 3) AND (c.ChangeType = 'CR')
AND (dlv.Name = 'Common Route') AND (c.ProductGroup = 1)
ORDER BY c.Submission_Date DESC

73239 3/7/2005 Publish HasReportableParts 100 Common
Route Open-Filed TEF Integration
73239 3/7/2005 Publish HasReportableParts 100 Common
Route Open-Filed TEF Integration
73239 3/7/2005 Publish HasReportableParts 100 Common
Route Open-Filed TEF Integration
73239 3/7/2005 Publish HasReportableParts 100 Common
Route Open-Filed TEF Integration

Any ideas what might be wrong here ?

thanks
Sunit

Aug 12 '05 #1
2 1342
AK
not enough information, but anyway: have you tried DISTINCT keyword?

Aug 12 '05 #2
On 12 Aug 2005 09:46:10 -0700, sjoshi wrote:
I'm trying this simple query but getting multiple listings for
change_number field

SELECT c.Change_Number, c.Submission_Date, c.Short_Description,
c.CurrentStatus, dlv.Name, s.Description, kw.Subcategory
FROM Changes c
INNER JOIN Deliverables dlv ON c.Deliverable = dlv.DlvID
INNER JOIN Keywords kw ON c.Deliverable_Keyword = kw.KywID
INNER JOIN Status s ON c.CurrentStatus = s.Status
WHERE (c.Application = 3) AND (c.ChangeType = 'CR')
AND (dlv.Name = 'Common Route') AND (c.ProductGroup = 1)
ORDER BY c.Submission_Date DESC
(snip)
Any ideas what might be wrong here ?


Hi Sunit,

That means that you have more than one matching row in at least one of
the joined tables. Copy and paste the code below into Query Analyzer to
see how rows can be duplicated in a join.

To solve it, we need to know more about your data, tables and
requirements. See www.aspfaq.com/5006.
CREATE TABLE Test1 (A int NOT NULL PRIMARY KEY,
B int NOT NULL)
CREATE TABLE Test2 (C int NOT NULL PRIMARY KEY,
D int NOT NULL)
INSERT INTO Test1 (A, B)
SELECT 1, 1
UNION ALL
SELECT 2, 1
INSERT INTO Test2 (C, D)
SELECT 1, 1
UNION ALL
SELECT 2, 1
UNION ALL
SELECT 3, 2

-- Show what's in the tables
SELECT A, B FROM Test1
SELECT C, D FROM Test2

-- Do a join - some row match two other rwos
SELECT Test1.A, Test1.B
, Test2.C, Test2.D
FROM Test1
INNER JOIN Test2 ON Test2.D = Test1.A

-- Same join - but this time, hide some of the columns
-- now we really appear to ahve duplicates!
SELECT Test1.A, Test1.B
-- , Test2.C, Test2.D
FROM Test1
INNER JOIN Test2 ON Test2.D = Test1.A

-- Done - clean up the used tables
DROP TABLE Test1
DROP TABLE Test2
Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Aug 12 '05 #3

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

Similar topics

3
by: Neil Trigger | last post by:
Hiya, I'm trying to work out how to query a database in MySQL, get a nuumber of listings that match some of the criteria. For example the database has a "town" field. If the town field matches the...
4
by: John Pether (john | last post by:
Hi I have a page that displays business listings. I have a repeater with dynamic text and in the 4th column I have an email and website link. Both display properly but I need to have one take...
0
by: Rudi Ahlers | last post by:
Hi Can someone please tell me howto update a field (which is auto_increment) for a range from say 4000 - 8000? I only want to change info for listings in that range, if my database has about...
3
by: Keith Chadwick | last post by:
We current have a bunch of web services that make user of the SQLXML object. A template is created in code which calls several stored procedures each of which returns multiple xml recordsets from...
1
by: Casey | last post by:
Hi, How would one allow for possible multiple search criteria using FREETEXTTABLE. For example, my table "listings" has a full-text search catalog, and I may want to: SELECT * FROM listings...
1
by: techmistress | last post by:
Hi, hope someone can help. I think it may be easy, but I'm not skilled enough. - I have 2 tables: listings and agents - Both tables have a field AgentID - Agents table has a field ExpDate,...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
0
by: richard12345 | last post by:
Hi Guys I have problem with site I am building. The sidebar with menu and other thinks is overlapping footer. The footer move with the content and but it dos it dos not move with the sidebar. ...
7
by: samatair | last post by:
I need to change an existing listings page with pagination. Each page shows 10 listings and they are ordered by the date they are added to the site. Now recently added listings show up in the...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.