I am a begginer in this tool...
I have a table that contain information about printers, they are identified by the serial number... in the same table a I have information about each one by date, for example:
So, I want a query that show me the toner percent by date in the next structure
And that later on I will can to see if there were changes, for example. Maybe one day the %toner is 20 and the next is 90 so I can say that there were a toner-change---
I did the next...
, toner as '%date14'
, (select toner
) as '%date20'
where date ='2009-03-14'
with this query I can get in the same answer:
serial %toner14 %toner20
serial1 20 30
But I can do it only with one serial and I want with a lot of them !!!!!
If I erase the "and noSerial='serial1'" to the subquery sql return me the message
"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
and of course if I erase the same statement to the query I can get all my list.
use a self join e.g.
, a.toner as '%date14'
, b.toner as '%date20'
from discovery a
join discovery b
where a.date ='2009-03-14'