How can I get the distinct rows? [message #621161] |
Sun, 10 August 2014 21:36 |
|
zhuyeq
Messages: 3 Registered: August 2014
|
Junior Member |
|
|
I'm not professional
I want to get the "right result",(see picture)
but when select from large data ,
its takes a long time using "group by" or "distinct",
have any other "professional" sentence ?
Thanks!
select
test1.id1,
test1.id2,
test1.doctor,
test1.ordering_d,
test2.ITEM_NO,
test2.item_name,
test2.amount,
test2.COSTS
FROM test1 ,test2
WHERE test1.id1=test2.id1
AND test1.id2=test2.id2
AND test1.order_code = test2.item_code
AND test2.item_name like 'test drug 1'
GROUP BY test1.id1,tet1.id2,doctor,ordring_d,item_no,item_name,amount,costs
-
Attachment: question.JPG
(Size: 182.32KB, Downloaded 1076 times)
[Updated on: Sun, 10 August 2014 21:47] Report message to a moderator
|
|
|
|
|
|
|