Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Logic

 
sigamala viswanath
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have one problem with database logic.

I will explain the problem clearly :

1. suppose the some products are developed some companies such that
same product is developed by different companies .

such as

company name item name costper item
Min qty for discount discount

s1 I1 6
100 4%
s2 I1
10 200
10%
s3 I1
8 400
20%
s4 I1
9 200
15%


Hope above sheet is clear .. Here Different companies r giving same items
in different cost and different discount ..

But for the user as product is same he need lowest cost price company
product .. how can we find this ???

Please send the logic if any body know this..

Use give the input as:

Item Name : I1
Quatity : 250


OutPut :

company name item name cost per item min qty
discount discount total cost

s1 I1 6
100 4 XXXXX

Above output is sample not exact..



Thanks,

Viswanath
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sigamala

Please use [�CODE�] tag to preserve formatting, assuming your data is in your table. execute a query like


SELECT * FROM TAB WHERE ITEM_NAME='I1' and Min_qty >=250 and costper_item =(SELECT MIN(costper_item) FROM TAB)


This is a quick query. The are other ways to solve this problem


Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic