Help in SQL Query - Sajha Mobile
SAJHA MOBILE
Help in SQL Query
Posts 9 · Viewed 6223 · Likes 1 · Go to Last Post
Ghiraunla
· Snapshot 0
Like · Likedby · 0
Hi SQL Gurus,

I need to join two tables say Table I and Table W

Table I is like below

Numbers Values
1 A
1 B
2 C
3 D

Table W is Like Below
Numbers Boolean
1 Yes
1 Yes
2 Yes
3 Yes

I need to query to join Table I and W where Boolean value is Yes in Table W but there is no D in Table I in Oracle database. The answer would be
Number
1
2
Can someone help me get a query?
pidiiit
· Snapshot 61
Like · Liked by · 0
Hey, your requirement is confusing. What does it mean by "where Boolean value is Yes in Table W but there is no D in Table I in Oracle database"
panacea
· Snapshot 57
Like · Liked by · 0
If there is no value D in table I then when you join both the tables on numbers, you will automatically get the those two numbers as you distinct them. Not sure, what your question is actually?
KaliKoPoi
· Snapshot 108
Like · Liked by · 0
First join like this:
select i.Numbers as Number from I i join W w on i.Numbers = w.Numbers
Then use filter to get the record you need:
where w.Boolean="Yes" and i.Values != 'D'

Actual query depends on database you are using.
jaxnepali
· Snapshot 142
Like · Liked by · 0
try this..very generic

select * from i where values  <> 'D' and numbers in (select numbers from w where boolean = 'Y')

- Jaxnepali
Last edited: 02-May-17 09:29 AM
c864916
· Snapshot 237
Like · Liked by · 1
There is an online application for testing and sharing SQL queries called SQLFiddle.com.
Here's a quick fiddle I created for you.
http://sqlfiddle.com/#!9/393cc/4
ikauda
· Snapshot 250
Like · Liked by · 0
are you interested in basic to advance level SQL training please contact hr@ikauda.com

-----
New QA training session starting this wednesday( 05/02/2017)
daniachhetri_geekIt
· Snapshot 274
Like · Liked by · 0
ikauda,
How much do you charge for your trainings?

Thank you,
Dania

Dania Chhetri
Senior Resource Manager
Geek IT Solution LLC
Email: dania@geekitsolution.com
Direct: 972-358-3131
Linkedin: Dania Chhetri
Google Hangout: geekitsolution.midwest@gmail.com

Note: If you were unable to reach me please contact our President, Santosh Bhattarai at santosh@geekitsolution.com or you may call him at: 913-515-5346. He can also be reached on hangouts at: geekit.kansas@gmail.com
ikauda
· Snapshot 303
Like · Liked by · 0
zero cost....... thousands to benefit ( to candidates)...... 
Last edited: 02-May-17 01:29 PM
Last edited: 02-May-17 01:31 PM
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 9 · Viewed 12275 · Likes 1
· Posts 7 · Viewed 3685 · Likes 1
· Posts 1 · Viewed 1032
· Posts 1 · Viewed 985
· Posts 1 · Viewed 887
· Posts 1 · Viewed 988
· Posts 1 · Viewed 974
· Posts 21 · Viewed 9431 · Likes 1
· Posts 3 · Viewed 2394
· Posts 5 · Viewed 7554 · Likes 1



Your Banner Here
Travel Partners
Travel House Nepal