If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > interbase sql query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-04-03, 07:15
gameover gameover is offline
Registered User
 
Join Date: Jul 2003
Posts: 7
Unhappy interbase sql query

Hi,

I am trying to run the following query but it does not work.

select sum(distinct i.quantity as VAL), i.oemnumber
from issuedstock i, so_oem_lookup s
where i.sonumber = 112
and i.oemnumber = s.oemnumber
and s.qtyneeded = VAL
group by i.oemnumber

I want to check the sum of a bunch of fields in one table against one field in another table, and if they match to display the results. This isn't working however.....

The sum of all of the quantity fields in issuedstock should match with the qtyneeded in the so_oem_lookup table.

~Can anyone see a way to do this? I've tried to use AS but I am getting nowhere.

Thanks in advance

Chris Moore

Error Message in IBConsole:

Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 31
as
Statement: select sum(distinct i.quantity as VAL), i.oemnumber
from issuedstock i, so_oem_lookup s
where i.sonumber = 112
and i.oemnumber = s.oemnumber
and s.qtyneeded = VAL
group by i.oemnumber
Reply With Quote
  #2 (permalink)  
Old 08-24-03, 07:14
goreXP goreXP is offline
Registered User
 
Join Date: Nov 2002
Location: Romania
Posts: 1
Re: interbase sql query

Quote:
Originally posted by gameover
Hi,

I am trying to run the following query but it does not work.

select sum(distinct i.quantity as VAL), i.oemnumber
from issuedstock i, so_oem_lookup s
where i.sonumber = 112
and i.oemnumber = s.oemnumber
and s.qtyneeded = VAL
group by i.oemnumber

Try: select sum(distinct i.quantity) as VAL ...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On