Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 17th, 2004, 11:13 PM
Authorized User
 
Join Date: Nov 2003
Location: , , Australia.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default select problem

hello,

I have a single table with a design something like this

name value
item1 123
item2 456
item3 234
item1 245
item4 278
item2 763
item1 741

what i need to do is select all 'name' where there is multiple entrys eg return
item1 123
item1 245
item1 741
item2 456
item2 763

any sugestions would be appreciated


Chris

Reply With Quote
  #2 (permalink)  
Old May 18th, 2004, 08:56 AM
Authorized User
 
Join Date: Apr 2004
Location: , , Ireland.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

select * from TABLE
where name not in
(select name,count(*)
from TABLE
group by name
having count(*) = 1)
order by name

Reply With Quote
  #3 (permalink)  
Old May 18th, 2004, 06:35 PM
Authorized User
 
Join Date: Nov 2003
Location: , , Australia.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,
The above query gives the following error message:
You've written a subquery that can return more than one fiel without using the EXISTS reserved word in the main query's FROM clause. Revise the SELECT statement of the subquery to request only one field.


I have used
select name,count(*)
from TABLE1
group by name
having count(*) > 1
to return what 'names' are entered more than one but i would like to be able to see the 'value' for each 'name' without having to use it in another query.

By the way im useing a Access DB


Chris

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Problem - Newbie jackiew SQL Server 2000 3 October 14th, 2008 07:44 PM
select problem hastikeyvan SQL Server 2000 2 May 17th, 2008 03:13 AM
multiple select problem austinf HTML Code Clinic 0 June 19th, 2006 11:54 PM
select top problem keyvanjan SQL Server 2000 5 January 7th, 2006 07:11 AM
Select Within A Select Problem vinyl-junkie Classic ASP Databases 6 June 7th, 2003 04:31 PM



All times are GMT -4. The time now is 04:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.