We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

SQL synthax

Medium Priority
249 Views
Last Modified: 2012-05-11
Hello EE,

I am not sure how to do this.. :

lets say in the table we have :

ID              LineNumber             Amount

1                      1                           0
1                      2                           0
1                      3                          100
2                      1                           0
2                      2                           50


if the user in his Menu click Open...   and choose to open ID 1
I would like the query to show all the ID (even ID 2)  but (and here is my problem) because he chose ID 1 I want to show all row of ID 1 but because he didnt chose ID 2 I need to show only rows of ID 2 that are amount at 0..

so result would be like this:

1    1   0
1    2   0
1    3   100
2    1   0


(not the lineNo 2 of ID 2 because amount is > 0 )
Comment
Watch Question

Sorry I didn't get you exact requirement. Exaplin it clearly

Author

Commented:
my table:

ID              LineNumber             Amount

1                      1                           0
1                      2                           0
1                      3                          100
2                      1                           0
2                      2                           50

if user choose ID 1

query result :   All rows of ID1  + rows of all other ID's where amount = 0

if user choose ID 2
query result:  all rows id2 + rows of all other id's where amount = 0
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
do you think its possible without sending parameter

in your code your hardcode 1  wich i understand you want me to pass a parameter

Author

Commented:
no i believe its not possible.
its fine thanks
Yes you need to pass parameter.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.