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

a SQL query question

 
jenny brad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a Sql question:

I need to get data from order(call Or), and orHeader(orHd) tables. Or contains the order info while OrHd contains the contact, location info for that order.

some orders have more than one locations in the orHd. I need to get the orders with only one location. this is my query:

select * from oritems, orheader where oritems.itemid = orheader.orderno and orheader.orderno in
(select orheader.orderno from orheader where 2 >
(SELECT COUNT(orheader.orderno)
FROM orheader))

it didn't work properly.

Can someone give me some advice?

Thank you!
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following sql should solve you problem

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic