Click to See Complete Forum and Search --> : How to split a query result in multiple rows


mao
04-18-2007, 03:56 PM
This is the case.
Lenguage used: ASP
DB: SQL

Problem:
I am running a SELECT query and need to display the result values of a table column in multiple rows.

QUERY:
mySQL="SELECT items FROM products WHERE items=new"

The result is

Ball, ballon, baseball, basktball, football

I need the result to be in the following format (by rows)

Ball
Ballon
Baseball
Basketball
Football

The code that I am using to perform this task is

NewItems = split(items,",")

when I use this code I do NOT get any results displayed.

Can anyone help me with the correct code to make this happen???

PLEASE HELP.

webbertc
05-18-2007, 01:26 PM
Sounds as though your database is not normalized. You should not have comma separated lists stored as single values in the database. If you redesign your table in such a way that the values are stored individually, you won't have to worry about doing a split for the output.

russell
05-19-2007, 03:14 AM
lets see yer code