- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我用这个“union select”查询数据库时:
select stampata_sn,numero_conto,dest_stampa,portata,categoria,prog_inser,nodo,desc_art,prezzo_un,quantita from comanda where contiene_variante='1' and ntav_comanda='1' and posizione='CONTO' and stato_record='ATTIVO' and numero_conto = '1'
union all
select stampata_sn,numero_conto,dest_stampa,portata,categoria,prog_inser,nodo,desc_art,prezzo_un,sum(quantita) as quantita from comanda where (contiene_variante !='1' or contiene_variante is null) and length(nodo)=3 and ntav_comanda='1' and posizione='CONTO' and stato_record='ATTIVO' and numero_conto = '1' group by desc_art
union all
select stampata_sn,numero_conto,dest_stampa,portata,categoria,prog_inser,nodo,desc_art,prezzo_un,quantita from comanda where length(nodo)=7 and ntav_comanda='1' and posizione='CONTO' and stato_record='ATTIVO' and numero_conto = '1' order by nodo asc;
我按顺序提取这些数据:
PROGRESSIVO NODO PRODOTTO QUANTITA
0 000 SAN PELLEGRINO 1
1 001 MINERALWASSER 0.2 l 1
2 002 MINERALWASSER 0.4 l 1
3 003 COCA COLA 0.2 l 3
4 004 COCA COLA 0.4 l 1
5 005 COLA LIGHT 0.2 l 5
6 006 COLA LIGHT 0.4 l 3
7 007 APFELSAFT 0.4 l 1
12 007 012 +SCHWARZWALD 1
13 007 013 -ERDBEEREN 1
8 008 APFELSAFT 0.2 l 2
10 010 SPRITE 0.4 l 1
11 011 SPRITE 0.2 l 1
顺序是正确的,因为变体链接到产品,但我想按字母顺序查看它们,如下所示:
PROGRESSIVO NODO PRODOTTO QUANTITA
11 008 APFELSAFT 0.2 I 2
7 007 APFELSAFT 0.4 I 1
8 007 012 + SCHWARZWALD 1
10 007 013 - ERDBEEREN 1
3 003 COCA COCA 0.2 I 3
4 004 COCA COLA 0.4 I 1
5 005 COLA LIGHT 0.2 l 5
6 006 COLA LIGHT 0.4 l 3
1 001 MINERALWASSER 0.2 l 1
2 002 MINERALWASSER 0.4 l 1
0 000 SAN PELLEGRINO 1
12 011 SPRITE 0.2 l 1
13 010 SPRITE 0.4 l 1
我该怎么办?
最佳答案
您可以尝试将 SQL 包装在外部 SQL 中,如下所示
select A.stampata_sn
,A.numero_conto
,A.dest_stampa
,A.portata
,A.categoria
,A.prog_inser
,A.nodo
,A.desc_art
,A.prezzo_un
,A.quantita
FROM
(
select stampata_sn
,numero_conto
,dest_stampa
,portata
,categoria
,prog_inser
,nodo
,desc_art
,prezzo_un
,quantita
from comanda
where contiene_variante='1'
and ntav_comanda='1'
and posizione='CONTO'
and stato_record='ATTIVO'
and numero_conto = '1'
union all
select stampata_sn
,numero_conto
,dest_stampa
,portata
,categoria
,prog_inser
,nodo
,desc_art
,prezzo_un
,sum(quantita) as quantita
from comanda
where (contiene_variante !='1' or contiene_variante is null)
and length(nodo)=3
and ntav_comanda='1'
and posizione='CONTO'
and stato_record='ATTIVO'
and numero_conto = '1' group by desc_art
union all
select stampata_sn
,numero_conto
,dest_stampa
,portata
,categoria
,prog_inser
,nodo
,desc_art
,prezzo_un
,quantita
from comanda
where length(nodo)=7
and ntav_comanda='1'
and posizione='CONTO'
and stato_record='ATTIVO'
and numero_conto = '1'
) A
order by <Field to order by here> asc;
我不确定您想要使用哪个字段来排序,因为列标题 PRODOTTO 没有显示在列列表中。您可以使用任何列名称来排序,例如 -“A.portata”。
此外,按 desc_art 分组的第二个 SQL 似乎不符合 ANSI 标准,通常当您按所选列列表中的所有非聚合列进行分组时,应该是分组依据的一部分。您可能需要查看此内容并检查是否获得了正确的结果。
关于javascript - 如何订购预购餐 table ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34398616/
我的网站上有很多使用 tablesorter 的表,我正在寻找一种方法来对“sorter: 'digit' 具有特定类名的列进行排序:”class="note"。 我知道用标题来做到这一点: $(".
我们对数据库进行了分区,每个用户的数据都存储在特定的服务器上。 我的用例相当简单: 用户有对话。 对于一个对话,数据库中有两条代表记录(每个用户都有自己的对话记录)。 如果对用户进行删除操作,我想删除
我有一张 table 。例如: apple big pickle small 经过一些花哨的 jQuery... apple big 10kg -----
使用prawn gem我在pdf文件中显示表格..现在我想设置表格的位置,请指导我如何处理这个.. 我使用以下代码生成pdf报告, pdftable = Prawn::Document.new pdf
我是一名优秀的程序员,十分优秀!