4 Replies - 1106 Views - Last Post: 31 July 2010 - 04:56 PM Rate Topic: -----

#1 shairy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 23-June 10

subquery in where

Posted 30 July 2010 - 01:09 PM

I try to put subquery but it doesnt work where is the problem ?
"select DISTINCT[num of box],[machine num],[amount daily],[date of consumed] from total where [date of consumed] between # " & DateTimePicker1.Value.Date & " # and # " & DateTimePicker2.Value.Date & "# and [amount daily] = (select sum([amount daily])as [Amount daily] from total) "



Edited by macosxnerd101: Fixed code tags. Please, :code:.

Is This A Good Question/Topic? 0
  • +

Replies To: subquery in where

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: subquery in where

Posted 30 July 2010 - 02:03 PM

use inner join for this:
SQL INNER JOIN Keyword
Was This Post Helpful? 0
  • +
  • -

#3 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: subquery in where

Posted 30 July 2010 - 06:00 PM

i think at any cost this query will not return a single row

are you try to do get the daily total ?
Was This Post Helpful? 0
  • +
  • -

#4 shairy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 23-June 10

Re: subquery in where

Posted 30 July 2010 - 09:49 PM

View Postthava, on 30 July 2010 - 05:00 PM, said:

i think at any cost this query will not return a single row

are you try to do get the daily total ?



yes,I want to get the sum of amount daily why it will not return single row

This post has been edited by shairy: 30 July 2010 - 09:59 PM

Was This Post Helpful? 0
  • +
  • -

#5 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: subquery in where

Posted 31 July 2010 - 04:56 PM

use the GROUP BY or COMPUTE BY

one more link for groupby
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1