July 4, 2011 at 5:38 am
I have 2 tables: Issues and Attachement
Issue table contains 10 records and has the following design
IssueId
IssueName
IssueDate
IssueDescription
Attachement contains 5 records table has the follwing desin
IDAttachement
Filename
IssueID
I want to select everything from the 2 tables total 10 records as the following if fiename not exsits display No files
IssueID IssueName Filename
1 Issue1 file1
2 Issue2 Nofile
3 Issue3 Nofile
4 Issue4 Nofile
5 Issue5 Nofile
6 Issue 6 file6
7 Issue 7 file 7
8 Issue 8 file 8
9 Issue 9 file 9
10 Issue 10 Nofile
please help me to display Nofile if there was no attachement for the issue
I need the SQL select Query Please help
July 4, 2011 at 5:50 am
you will want to use an outer join (depends which way round you reference the tables as to a left or right) with the isnull functionality
July 4, 2011 at 5:52 am
can you please write the select for me
July 4, 2011 at 5:56 am
surely this will diminish the learning aspect
use books online and look at the isnull function and outter joins
this is a very simple statement you are after
July 4, 2011 at 6:02 am
Ok BABA
I will look it myself but i am not gonna mark your post as answered;-)
July 4, 2011 at 6:24 am
need your help
July 4, 2011 at 6:30 am
post your statement so far and I will see if your on the right track or not.
July 4, 2011 at 6:33 am
samiroko (7/4/2011)
Ok BABAI will look it myself but i am not gonna mark your post as answered;-)
FYI... there is no such function on these forums 😀
/T
July 4, 2011 at 6:40 am
common guys I need a solution
July 4, 2011 at 6:46 am
as others say, you want to do a outer join perhaps like the below example
you can find examples on books online, w3schools etc
select column,column2,column3
from tableA tblA(nolock)
left outer join tableB tblB(nolock) on tblA.collum=tablB.colmun
***The first step is always the hardest *******
July 4, 2011 at 6:46 am
July 4, 2011 at 6:49 am
Jayanth_Kurup (7/4/2011)
select * from issues ileft outer join attachments a
on i.id = a .id
this is similar to what you what , if your looking for spoon feeding , you need to wait till a better person than me comes along
it seems we are in the same boat, there is nothing like learning the solution for yourself, that way you can say you have completed the goal instead of someone telling you how to do it where you dont learn
July 4, 2011 at 10:03 am
add in here some code to create some representative data or what data you want and i will pop you some SQL
***The first step is always the hardest *******
July 5, 2011 at 12:26 am
Oh please! Do your OWN homework!!!! This is stupid easy stuff that you can get help with from Books On Line (BOL)... It's not our fault you're too lazy to do your own homework!
July 5, 2011 at 3:34 am
I will not go so far as to yell at you, but this is a question which answer can be found almost every lesson 2 of sql.
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply