Answer the question
In order to leave comments, you need to log in
How to facilitate selection by attributes?
select
t1.value_int y,t2.value_int m,t3.value_int d,
t4.value_string utm_source,
k.value_int kind_int,
i.count cnt
from stat_item_attrs k
left join stat_item i on i.id = k.item_id
inner join stat_item_attrs t1 on t1.item_id = k.item_id and t1.attr_type = 1/*y*/
inner join stat_item_attrs t2 on t2.item_id = k.item_id and t2.attr_type = 2/*m*/
inner join stat_item_attrs t3 on t3.item_id = k.item_id and t3.attr_type = 3/*d*/
inner join stat_item_attrs t4 on t4.item_id = k.item_id and t4.attr_type = 4/*utm_source*/
where
k.attr_type = 0/*kind*/ and k.value_int in(0,1)/*hosts,leads*/
and
t1.value_int = 20 and t2.value_int = 4 and t3.value_int = 4 /*20-04-04*/
and
t4.value_string = 'google'
;
y m d kind value
20 4 4 0 500
20 4 4 1 10
20 4 3 0 10
20 4 3 1 0
y m d kind0 value0 kind1 value1
Answer the question
In order to leave comments, you need to log in
I'm using
* tFPDF (based on FPDF 1.7)
* Version: 1.24
also need to put the font in a folder next to the file.
Initiation:
$pdf = new PDF();
$pdf->SetLeftMargin(25);
// Add a Unicode font (uses UTF-8)
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',10);
$pdf->AddPage();
.....
Are you sure it's a scribble and not a binary? Looks more like a binary, i.e. everything is ok, pdf is there, you just open it with a text viewer. And pdf still doesn't support html, css, etc. you will not get 1 in 1, the only way is html in canvas and then push these pictures into pdf.
select
case when t1.attr_type = 1 and t1.value_int = 20 then t1.value_int end y,
case when t1.attr_type = 2 and t1.value_int = 4 then t1.value_int end m,
case when t1.attr_type = 3 and t1.value_int = 4 then t1.value_int end d,
case when t1.attr_type = 4 and t1.value_string = 'google' then t1.value_string end utm_source,
k.value_int kind_int,
i.count cnt
from stat_item_attrs k
left join stat_item i on i.id = k.item_id
join stat_item_attrs t1 on t1.item_id = k.item_id and t1.attr_type in (1/*y*/,2/*m*/,3/*d*/4/*utm_source*/) and (t1.value_int in (20, 4 /*20-04-04*/) or t1.value_string = 'google')
where
k.attr_type = 0/*kind*/ and k.value_int in(0,1)/*hosts,leads*/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question