SQL Help Please!! :)

Sep 14, 2007 7 Replies

select item.itemlookupcode, item.description, quantitydiscount.description AS Discount_Description from item, quantitydiscount where item.quantitydiscountid = quantitydiscount.id and item.quantitydiscountid 0



The select query above returns item lookup code, description, and the quantity discount descritiption and lets me see every item in my DB which is assigned to a promotion. Can anyone help me by adding the item price, department and supplier name to the query so i can see those details?



Thanks very much!


Hi Philip...extend the select query the following way

select item.itemlookupcode, item.description, item.price, department.name, supplier.suppliername, quantitydiscount.description AS Discount_Description from item, department, supplier, quantitydiscount where item.quantitydiscountid = quantitydiscount.id and item.departmentid = department.id and item.supplierid = supplier.id and item.quantitydiscountid 0

H> select item.itemlookupcode, item.description, quantitydiscount.description

hi Philips, the Convoluted output will be okay as far as query but it won't give you those items which does not have department or supplier assinged but have discount scheme attached to it. better use follwoing:

select item.itemlookupcode, item.description, item.price, department.name, supplier.suppliername, quantitydiscount.description AS Discount_Description from item LEFT JOIN department ON item.departmentid = department.id LEFT JOIN supplier ON item.supplierid = supplier.id INNER JOIN quantitydiscount ON item.quantitydiscountid = quantitydiscount.id and item.quantitydiscountid 0

"Philip Gass" wrote:

Thanks guys - thats great!

Have you ever used MSQuery? This is the easiest way to visually build a query from RMS. You can then get the SQL from the query that you built and use it in RMS Admin in the future.

Hi Jason,

Where is "MSQuery" ?

It's part of MS Office if you have it installed.

Usually in "C:\Program Files\Microsoft Office\Office12\MSQRY32.EXE" (change the "12" to whatever version of office you have).

THX !

I am more of a network administrator. Perhaps MSQuery will open the door to solid basic database know-how ...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required