SQL Help Please!! :)

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!

Reply to
Philip Gass
Loading thread data ...

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

Reply to
convoluted

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:

Reply to
Akber Alwani

Thanks guys - thats great!

Reply to
news.microsoft.com

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.

Reply to
Jason

Hi Jason,

Where is "MSQuery" ?

Reply to
Frederic Hurlet

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).

Reply to
Jason

THX !

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

Reply to
Frederic Hurlet

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.