ersaurabh101 Posted April 17, 2017 Share Posted April 17, 2017 My command is $stmt2 = "select rowsno , comid , sno , tag_from FROM tasktag where COMID='$COMID' and TAG_FROM = '$TAGFROM'"; I want to fetch 1 more value in it but from a different table using the sno from the above select command If wish to fetch LATEST_ACTIVITY_NO from admtask where sno = sno I want this inside stmt2 command only because its returning an array like this - [ { "ROWSNO": "2224", "COMID": "54578", "SNO": "31598", "TAG_FROM": "SAURABH" } ] and i wish to include LATEST_ACTIVITY_NO in it Quote Link to comment Share on other sites More sharing options...
dkub Posted April 17, 2017 Share Posted April 17, 2017 Sounds like you're looking for a JOIN Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 18, 2017 Share Posted April 18, 2017 You do realize that sql statements use case-sensitive names for the fields? Do you really have a field named 'comid' as well as 'COMID'? And is your php variable also $COMID? Quote Link to comment Share on other sites More sharing options...
NigelRel3 Posted April 18, 2017 Share Posted April 18, 2017 You do realize that sql statements use case-sensitive names for the fields? Although consistency of names IMHO is important, just to clarify ( from https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html ) Column, index, stored routine, and event names are not case sensitive on any platform, nor are column aliases. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 18, 2017 Share Posted April 18, 2017 OMG! All this time I have been slaving away making sure of my case usage and now I find out what you knew all the time. Don't know what made me think that case mattered.... What an idiot I am! Quote Link to comment Share on other sites More sharing options...
NigelRel3 Posted April 18, 2017 Share Posted April 18, 2017 OMG! All this time I have been slaving away making sure of my case usage and now I find out what you knew all the time. Don't know what made me think that case mattered.... What an idiot I am! I think it's better to maintain the same case anyway - using Linux a lot means you tend to get used to the fact that case matters in a lot of things (which is why table names can be case sensitive) I'm a fan of camel case and I think it makes things more readable - but inconsistent use of case for the same field can (IMHO) lead to confusion. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.