Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. LINQ - Multiple Not Exists

LINQ - Multiple Not Exists

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqsales
2 Posts 2 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mebjen
    wrote on last edited by
    #1

    Guru's I need your help. I've been trying to figure out how to write the following SQL code in VB.NET LINQ but haven't had any luck. Any suggestions would be appreciated: SELECT t.CUSTOMER_ID,t.INVOICE_NUMBER,t.INVOICE_DATE,t.GROSS_AMOUNT_DUE,t.DUE_DATE FROM ARN_1 t WHERE RECORD_TYPE = '1' AND NOT EXISTS(SELECT INVOICE_NUMBER FROM ARN t1 WHERE t1.INVOICE_NUMBER = t.INVOICE_NUMBER AND t1.RECORD_TYPE = '7') AND NOT EXISTS (SELECT INVOICE_NUMBER FROM ARN_1 t2 WHERE t2.INVOICE_NUMBER = t.INVOICE_NUMBER AND t2.RECORD_TYPE = '5') AND t.DUE_DATE < '2017-11-13'

    MB

    M 1 Reply Last reply
    0
    • M mebjen

      Guru's I need your help. I've been trying to figure out how to write the following SQL code in VB.NET LINQ but haven't had any luck. Any suggestions would be appreciated: SELECT t.CUSTOMER_ID,t.INVOICE_NUMBER,t.INVOICE_DATE,t.GROSS_AMOUNT_DUE,t.DUE_DATE FROM ARN_1 t WHERE RECORD_TYPE = '1' AND NOT EXISTS(SELECT INVOICE_NUMBER FROM ARN t1 WHERE t1.INVOICE_NUMBER = t.INVOICE_NUMBER AND t1.RECORD_TYPE = '7') AND NOT EXISTS (SELECT INVOICE_NUMBER FROM ARN_1 t2 WHERE t2.INVOICE_NUMBER = t.INVOICE_NUMBER AND t2.RECORD_TYPE = '5') AND t.DUE_DATE < '2017-11-13'

      MB

      M Offline
      M Offline
      Maciej Los
      wrote on last edited by
      #2

      Sorry, but your query looks ugly and probably is inefficient... First of all, the query you provided is "asking" your database (ARN_1 table) 3 times! You have to re-think your sql statement. There must be shortest (easiest) way! Secondly, you did not provide a linq version and did not provide why you had no luck till this moment. Please, edit your question and provide more details. A piece of input data and expected output might be helpful to understand your issue.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups