Get your CodeRanch badge!*
The moose likes JDBC and the fly likes Problem in fetching records Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in fetching records" Watch "Problem in fetching records" New topic
Author

Problem in fetching records

Akash Abrol
Greenhorn

Joined: Jan 30, 2006
Posts: 9
Hi,
I have a table with two columns: loginID and PhoneNo. There can be many phone no's associated with one login ID and there will be one row each for a loginID,Phone No pair....

Now, if i select all the records from the table, there may be different rows with same loginID.

Is there any possible SQL query that gives me records as:

LoginID, {A comma separated list of all phone no's}

So that there is only one row for each loginID.

Regards,
Akash.
Sathya Prabhu
Greenhorn

Joined: Mar 10, 2006
Posts: 12
Hi,

There is no SQL query that can retrieve directly the records which you are asking for.

One alternative is using an ORDER BY clause.But one good option will be normalising ur tables!!!

Sathya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in fetching records
 
Similar Threads
memory usage with EntityBeans
Deleting Duplicate Rows.
Printing records in two or more columns
Tables in JSP Report
Populating values to feilds from the Table