MySQL Forums
Forum List  »  Newbie

Mysql sorting problem
Posted by: DRAGAN DRAGANOV
Date: October 26, 2018 04:25AM

Hi guys,

It's my first post so I apologise it it's in the wrong category. I have a struggle with getting info from DB. The DB have 2 tables:
1. results:
test_code varchar(6)
result varchar(200)
patient_id bigint(20)
barcode varchar(20)
id int(11)
date varchar(20)
patient_idn varchar(10)

2. tests
name varchar(100)
button varchar(50)
code varchar(6)
up varchar(50)
down varchar(50)
unit varchar(10)
flag varchar(20)
id int(11)
price varchar(5)

The SQL at the moment is something like that

SELECT * FROM results LEFT JOIN tests ON results.test_code = tests.code WHERE patient_idn = '".$patient['data'][0]['idn']."' GROUP BY results.test_code ORDER BY results.date";

But I need to represent the information in a table like that:

------------------------------------------------------------------
results.date | results.date | results.date | results.date
------------------------------------------------------------------
tests.name | results.result|results.result|results.result|results.result
------------------------------------------------------------------
tests.name | results.result|results.result|results.result|results.result
------------------------------------------------------------------
tests.name | results.result|results.result|results.result|results.result
------------------------------------------------------------------

I have no idea how to do it. Thanks for any help. Sorry for my bad english...

Options: ReplyQuote


Subject
Written By
Posted
Mysql sorting problem
October 26, 2018 04:25AM
October 26, 2018 10:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.