Welcome to WebmasterWorld Guest from 3.226.243.130

Forum Moderators: open

Message Too Old, No Replies

Form a query

     
10:53 am on Sep 5, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 3, 2004
posts:598
votes: 0


I need some help in a query
i have database where i need to find all inclusive words from table such this:
ids = word
1 concrete
1 metal
1 beton
2 seem
2 make
3 find

i need following database output
1 concrete,metal,beton
2 seem,make
3 find

how i can make this?

12:38 pm on Sept 5, 2006 (gmt 0)

New User

10+ Year Member

joined:Feb 2, 2005
posts:34
votes: 0


Hi, if this is MySQL database then:

SELECT id, GROUP_CONCAT(word SEPARATOR ', ') AS words
FROM table
GROUP BY id
6:10 am on Sept 6, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 3, 2004
posts:598
votes: 0


i have a mysql 4.0 and haven't group_concat, may be somebody have another way?
5:11 pm on Sept 6, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


You won't be able to use subqueries either then. You'll have to loop and put them together yourself. Here is an example in PHP ...
[webmasterworld.com...]
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members