0
SELECT t1.pgrpname, t1.pgrpval, t0.prodname 
FROM tproduct t0 inner join lpropgr l0 on l0.prodsern=t0.prodsern
INNER JOIN tpgroups t1 on t1.pgrsern=l0.pgrsern 
WHERE lower(t1.pgrpname) in ('brand', 'class1', 'display') 
ORDER BY t1.pgrpname collate nocase, t1.pgrpval collate nocase, t0.prodname collate nocase
4

2 回答 2

0

in ('brand', 'class1', 'display')所以,答案是改变in ('%@') and not('x' == substr(t0.prodname, 1, 1))整个查询:

SELECT t1.pgrpname, t1.pgrpval, t0.prodname 
FROM tproduct t0 
INNER JOIN lpropgr l0 on l0.prodsern=t0.prodsern 
INNER JOIN tpgroups t1 on t1.pgrsern=l0.pgrsern
WHERE lower(t1.pgrpname) in ('%@') 
AND NOT('x' == substr(t0.prodname, 1, 1)) 
ORDER BY t1.pgrpname collate nocase, t1.pgrpval collate nocase, t0.prodname collate nocase

只为任何想知道的阅读者。

于 2013-03-08T19:38:30.120 回答
0

That SQL should do the work.

     SELECT t1.pgrpname, t1.pgrpval, t0.prodname 
       FROM tproduct t0 inner join lpropgr l0 on l0.prodsern=t0.prodsern
 INNER JOIN tpgroups t1 on t1.pgrsern=l0.pgrsern 
      WHERE lower(t1.pgrpname) in ('brand', 'class1', 'display') 
        AND lower(substr(t0.prodname,1)) != (substr(t0.prodname,1))
   ORDER BY t1.pgrpname collate nocase, t1.pgrpval collate nocase

Just compares first char of the column with lower version of char

Edit : Sorry missed the open parenthesis.

This one only checks for lowercase x

     SELECT t1.pgrpname, t1.pgrpval, t0.prodname 
       FROM tproduct t0 inner join lpropgr l0 on l0.prodsern=t0.prodsern
 INNER JOIN tpgroups t1 on t1.pgrsern=l0.pgrsern 
      WHERE lower(t1.pgrpname) in ('brand', 'class1', 'display') 
        AND lower(substr(t0.prodname,1)) != 'x'
   ORDER BY t1.pgrpname collate nocase, t1.pgrpval collate nocase
于 2013-03-03T13:54:40.030 回答