仅检索类型为“re”而非“res”的行

时间:2016-05-10 20:16:42

标签: mysql

我想只得到那些类型只是're'而不是'res'的行,即下面例子中的输出将是2和4。

表结构和数据

import org.apache.nifi.processor.io.StreamCallback

import java.nio.charset.StandardCharsets

def flowFile = session.get()
if(!flowFile) return

flowFile = session.write(flowFile, {inputStream, outputStream ->
    inputStream.eachLine { line ->
        def a = line.replaceAll('\t', ' ').replaceAll('\r\n', ' ').replaceAll('¦', '|')
        outputStream.write("${a}\n".toString().getBytes(StandardCharsets.UTF_8))
    }
} as StreamCallback)

session.transfer(flowFile, REL_SUCCESS)

我试过这个:

library(shiny)

df<-mpg

ui<-shinyUI(fluidPage(fluidRow(column (12,

  uiOutput("limitedresults2"), 
  uiOutput("variants2"), 
  uiOutput("whatwaschoosen"),
  tableOutput("content")

  ))))




server<- shinyServer (function(input, output) {

  output$limitedresults2 <-renderUI({ 
    list (titlePanel("Select Data :"),
          selectizeInput(
            'choose_columns2', '', choices =  names(df), multiple =TRUE,
            options = list(
              placeholder = 'Please select Attribute(s)',
              onInitialize = I('function() { this.setValue(""); }')
            )))
  }) 

  dat<-reactive({
    sapply(df[,input$choose_columns2], unique)
  })

  output$variants2 <- renderUI({ 
    list (selectizeInput ('further', 
                          list('Choose Attribute(s) Value(s)', helpText("If you selected a variable that does not have more than one unique value, then the value will just appear as the name.")),
                          choices=dat(), 
                          multiple = TRUE,
                          options = list(
                            placeholder = 'Please select Value(s) of Attribute(s)',
                            onInitialize = I('function() { this.setValue(""); }'))) ,
          p(""))  
  })  

  output$whatwaschoosen<-renderTable({
    Attribute<-input$choose_columns2
    Value<-input$further
    data.frame(Attribute,Value)
  }) 



  output$content <- renderTable({
    if(is.null(input$choose_columns2))
      return()

    df1<-as.data.frame(df[input$choose_columns2])
    subsetdf<-df1[ which(df1==input$further), ]
    needssplit<-subset(df, df1==subsetdf )
    (split( needssplit , needssplit$manufacturer ) ) ## if comment out this line.. a data table will appear.. 
  })




})  #end server

shinyApp(ui, server)  

但我没有得到正确的结果。

2 个答案:

答案 0 :(得分:2)

这使得所有id只有req个条目

Select id 
from demo
group by id
having sum(type <> 'req') = 0

答案 1 :(得分:0)

不在

中使用
Select id from demo 
where id not in (select id from demo where type !="req" )