This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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