-4

I have a table as follows

Row 1:

did: 1
brand_name: Aarther P (100+500)
generic: Paracetamol, Aceclofenac
tradename: Aarther P (100+500)
manfactured: Rekvina Pharmaceuticals
unit: 500mg/100mg
type: Tablet
quantity: 10Tablet
price: 27.9

Row 2:

did: 2
brand_name: Aarther-P
generic: Aceclofenac, Paracetamol
tradename: Aarther-P
manfactured: Rekvina Pharmaceuticals
unit: 100mg/500mg
type: Tablet
quantity: 10Tablet
price: 27.9

If i search records based on generic like 'paracetamol' I want to display the results as follows:

Row 1:

did: 1
brand_name: Aarther P (100+500)
generic: Paracetamol
tradename: Aarther P (100+500)
manfactured: Rekvina Pharmaceuticals
unit: 500mg/100mg
type: Tablet
quantity: 10Tablet
price: 27.9

Row 2:

did: 2
brand_name: Aarther-P
generic:  Paracetamol
tradename: Aarther-P
manfactured: Rekvina Pharmaceuticals
unit: 100mg/500mg
type: Tablet
quantity: 10Tablet
price: 27.9

How can I do this?

4

3 回答 3

0

尝试这个

SELECT * FROM table WHERE generic LIKE '%paracetamol%'

这将选择通用行中包含“parcetamol”的任何记录。它还将选择具有“扑热息痛”和任何其他数据的任何组合的记录,例如:

“扑热息痛,阿司匹林” “可待因,扑热息痛” “阿司匹林,扑热息痛,阿司匹林”

于 2013-09-05T07:55:26.693 回答
0

如果您试图获取表的前两条记录,那么

select * from table limit 2;

如果打算获取通用列值为 Paracetmol 的所有记录,则

select * from table where generic='Paracetmol';
于 2013-09-05T07:48:50.080 回答
0
select `did`, `brand_name`, 'Paracetamol' as `generic`, `tradename`, 
`manfactured`, `unit`, `type`, 
`quantity`, `price` from table1 where 
find_in_set ('Paracetamol',generic) 
or find_in_set (' Paracetamol',generic)

样品小提琴

于 2013-09-05T07:53:42.197 回答