I would like to have multiple values nutrient_no:
ndb_no | nutrient_no | nutrient_value
--------+-------------+----------------
13473 | 203 | 24.18
13473 | 204 | 15.93
13473 | 205 | 0
13473 | 207 | 1.1
13473 | 208 | 247
13473 | 221 | 0
I'm thinking:
select nutrient_no, nutrient_value from nutrient_data where ndb_no =
13473 and (nutrient_no = '203' or nutrient_no = '204' or nutrient_no =
208);
Depending on what you are trying to achieve:
Particular ndb_no and multiple nutrient_no, note that output of ndb_no
is superfluous as it is always the same:
select nutrient_no, nutrient_value from nutrient_data where ndb_no =
13473 and nutrient_no in ('203', '204','208');
Size limited list (say top 5 nutrient values) for a given ndb_no:
select nutrient_no,nutrient_value from nutrient_data where ndb_no =
13473 order by nutrient_value limit 5;
Cheers,
Steve
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql