| От | mhewii@qix.net (Mark & Candice White) |
|---|---|
| Тема | search array field? |
| Дата | |
| Msg-id | 5e09903c.0202161541.2f143753@posting.google.com обсуждение исходный текст |
| Список | pgsql-general |
I need to do all the normal SQL stuff (SELECT,WHERE,ORDER BY)
on the elements of an array field.
I can not alter the schema, and the number of elements are
variable.
How do I do this?
table: name, data
"nameA",{"data1","data2"}
"nameB",{"data2","data3","data4"}
"nameC",{"data5"}
SELECT name, ?data? FROM table WHERE ?data? LIKE "data1" OR ?data? LIKE
"data2";
results=
nameA, data1
nameA, data2
nameB, data2
I am using PostgreSQL and PHP (the output is HTML).
I can get all the data, then pars it in php but that seems
like a wast of SQL, and impractical with any large number of records.
I would like to do it with as much SQL and little php as posible.
If this is a RTFM type question please tell me where in what M
to R.
Thank you.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера