Helpful Information
 
 
Category: PostgreSQL Help
Retrieving multiple rows

hello,

i need your help to my question:

i have this database called test, and i have a table called data. The table structure is as follow

cID SMALLINT
bID SMALLINT
name TEXT
email TEXT
site TEXT

bID is always an unique number for each row, while cID sometimes has same numbers in 2 or more rows. Example:

cID = 1
bID = 1
name = ss
email = ss
site = http://ss

cID = 1
bID = 2
name = ss
email = ss
site = http://ss

bID often differs. My question is see i want to SELECT all the rows that are the same cID. Normally i use:

SELECT * from data where cID = 1

but in this case there are more than 1 same values for cID. Is there anyway to retrieve the datas from multiple rows at the same time, and then put all the datas and values to arrays. For instance, in my mind it will be someone like:

test[0] = cID test[1] = bID
test2[0] = cID test2 [1] = another bID

:confused:

SQL Experts here, Any ideas? Thank you in advance for your help.

Vincent

Please see the manual of the language you are working in. Or you can read some examples, but I have to tell you that, if doing queries is the first step to database access, the second is to retrieve data.










privacy (GDPR)