473,806 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help getting multiple listings

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

SELECT c.Change_Number , c.Submission_Da te, c.Short_Descrip tion,
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_K eyword = 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_Da te DESC

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

Any ideas what might be wrong here ?

thanks
Sunit

Aug 12 '05 #1
2 1434
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_numbe r field

SELECT c.Change_Number , c.Submission_Da te, c.Short_Descrip tion,
c.CurrentStatu s, 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_K eyword = 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_Da te 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
3041
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 form's town field (as input from the user), that listing's "Title" field is printed. This title should act as a link to the full information of the listing. EG. The user enters "Plymouth" as the town, The php sends a query to the database
4
4840
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 precedent over the other, so if ("www") is not null then it should be displayed and the email shouldn't. I also need some script to only display either if the field is not null. This is not really my thing, and I have been trying to figure this out...
0
1208
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 75000 listings Kind Regards
3
1341
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 our SQL Server 2000 database. When the template is run an XSL transformation is automatically applied as well. The resulting document is then served to the caller. Due to the gods in charge they have decided in there infinite wisdom to disallow...
1
8176
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 WHERE name LIKE @name AND city LIKE @city I've got it working to select only by name: SELECT listing_id, RANK, name, address, city, zip, heading, phone FROM listings a,
1
979
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, listings does not - I created a field on listings called ExpDate How do I copy the "ExpDate" field from agents table into the ExpDate field on the agents table - making sure it's matching the same AgentID field? There may be more than one...
185
7146
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 return the file name given a FILE *. Questions: What would be the best name for this function?
0
2850
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. Here is the website: holtz-realty And also the html file and css file. Anny help will by mostly appreciated. I did try everything I can think of. HTML:
7
1898
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 first page. I need to get all the listings to come on the first page by rotating the showing of listings perhabs each day (each page should only show 10 listings). Thus first day showing first 10 listings in the first page and the next day showing...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.