My first query returns a SSN and a name to a drop down list box such as.
888997788--Malarkey John Lee
My next query needs to just take the SSN portion of this and query the database to find information about this individual. Orifinall I did it my name but names can be the same SSN's are never the same for same name. So how can I break apart the first query for the second query to look at. When the first query is returned you then pick on that individual to return more information so they need to be able to see individual name. following are SQL Syntax's
Thi spopulates DDL with list of names and SSN.
sql = "select sidstrSSN_SM + '--' + sidstrNAME_IND from CMS.dbo.tblSIDPERS where sidstrSSN_SM in (Select u.strSSN from tblAssignedPersonnel as u " _
& "where u.bitPresent = 1 and intDrillStatus = 2 and u.intUICID in (select intUICID from tblUIC where intTaskForceID = " & taskforceID & " and strUIC = '" & uic & "'))"
When they pick a name this sql query takes over and pulls more info, but I just need the SSN portion of the above query, how can I take off the name in the next query. because right now it looks a thte whole thing and returns a zero row to my labels.
sql = "select s.sidstrSSN_SM, s.sidstrGR_ABBR_CODE + '/' + s.sidstrPAY_GR as Rank, case when s.sidstrTECH_SVC_CODE in ('M', 'R', 'S', 'T', 'U', 'Z') then " _
& "case when s.sidstrACT_STAT_PROG in ('5', 'A', 'E', 'F', 'N', 'R', 'S', 'T') then 'AGR' else 'TECH' end else 'M-day' end, " _
& "s.sidstrST_ADDR + ',' + s.sidstrADDR_CITY + ',' + s.sidstrSTATES_US + ',' + s.sidstrZIP_CODE as address, " _
& "(select count(*) from saddotnet.dbo.tblAssignedP
ersonnel h where p.strSSN = h.strSSN and h.dtattendance <= p.dtattendance) as count_attendance_as_at_dta
ttendance,
" _
& "p.dtattendance from cms.dbo.tblSIDPERS as s INNER JOIN saddotnet.dbo.tblAssignedP
ersonnel as p on p.strSSN = s.sidstrSSN_SM where " _
& "sidstrSSN_SM like '" & SSN & "'"
Start Free Trial