• 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

 
Maybe he went home and went to bed. And took this tiny ad with him:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!