Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select statement using IN clase...???
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01123971
Message ID:
01124102
Views:
10
>>>FYI -
>>>SET DELETED ON was my problem...arrrggh!
>>>
>>
>>Did you try my SQL and Sergey's? Do they return the same result? I think mine is essentially the same as Rich's.
>
>Yes, I tried both.
>Sergey's worked, but it returned all the item_state ones, not just the two that I was looking for.
>Your's had some strange syntax error I couldn't get passed, and I didn't really understand the part of the statement where the 'step1' was. However you DID point out the >=2 intead of = 2 in Rich's - so hey - everyone helped..haha... gotta love the VFP community!

What did
select Items.Order_No, ;
Items.Item_State, ;
count(*) as cntStates from items ;
where items.item_state in ('PI', 'CM') ;
group by 1,2 ;
having cntStates >1
return?

The idea is to get orders with Items A & B. So, I used it as first step, then join with the orders. It would be easier to divide into two separate SQL.

If you look at Rich select and mine you'll see we used the same idea.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform