oosrikanth Posted June 27, 2012 Share Posted June 27, 2012 (edited) joining register table dno employee table dno result is below two tableregister table dno -- department -- deparment salary101 data processing 50,000102 printing 100,000103 design 250,000 employees 101 101/1 john101 101/2 james101 101/3 abott102 102/1 able102 102/2 adison103 103/1 alien103 103/2 alex103 103/3 alin103 103/4 casper out of above query below i need like below belt register table dno -- department -- deparment salary101 data processing 50,000102 printing 100,000103 design 250,000 employees 101 101/1 john101 101/2 james101 101/3 abott102 102/1 able102 102/2 adison103 103/1 alien103 103/2 alex103 103/3 alin103 103/4 casper out of above query below i need like below belt D NO DEPT D NO E NO E NAME101 data pro 101 101/1 john101 data pro 101 101/2 james101 data pro 101 101/3 abott102 printing 102 102/1 able102 printing 102 102/2 adison103 design 103 103/1 alien103 design 103 103/2 alex103 design 103 103/3 alin103 design 103 103/4 casper In need like this below "boolean" please take 1 min excuseD NO DEPT D NO E NO E NAME101 data pro 101 _______ 101/1 john_____________________101/2 james_____________________101/3 abott102 printing 102 _______ 102/1 able_____________________102/2 adison103 design 103 _______ 103/1 alien_____________________103/2 alex_____________________103/3 alin_____________________103/4 casper Edited June 28, 2012 by oosrikanth Link to comment Share on other sites More sharing options...
niche Posted June 27, 2012 Share Posted June 27, 2012 Please submit your jpg as an attachment not as a download. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 27, 2012 Share Posted June 27, 2012 I don't understand what your question is, but those queries are joining on the "owner" table, not the employee table. Link to comment Share on other sites More sharing options...
oosrikanth Posted June 30, 2012 Author Share Posted June 30, 2012 (edited) I don't understand what your question is, but those queries are joining on the "owner" table, not the employee table. link http://4.bp.blogspot.com/-wA9gkuQooMI/T-6RsLBXDFI/AAAAAAAAACU/oUxbP_dsroQ/s320/untitled.JPG Edited June 30, 2012 by oosrikanth Link to comment Share on other sites More sharing options...
oosrikanth Posted June 30, 2012 Author Share Posted June 30, 2012 (edited) select boollen(empid) as boollen (dept no)from table; Edited June 30, 2012 by oosrikanth Link to comment Share on other sites More sharing options...
justsomeguy Posted July 2, 2012 Share Posted July 2, 2012 linkhttp://4.bp.blogspot...20/untitled.JPGI can't read the text in that image, it's too small. I still don't understand what you're asking for, I can't understand the way you talk. If you want to display this result set: D NO DEPT D NO E NO E NAME101 data pro 101 101/1 john101 data pro 101 101/2 james101 data pro 101 101/3 abott102 printing 102 102/1 able102 printing 102 102/2 adison103 design 103 103/1 alien103 design 103 103/2 alex103 design 103 103/3 alin103 design 103 103/4 casper like this: D NO DEPT D NO E NO E NAME101 data pro 101 _______ 101/1 john_____________________101/2 james_____________________101/3 abott102 printing 102 _______ 102/1 able_____________________102/2 adison103 design 103 _______ 103/1 alien_____________________103/2 alex_____________________103/3 alin_____________________103/4 casper then that is not a SQL question, you'll need to format that in whatever language you're using to display or save the results. Link to comment Share on other sites More sharing options...
oosrikanth Posted July 3, 2012 Author Share Posted July 3, 2012 (edited) <quote>then that is not a SQL question, you'll need to format that in whatever language you're using to display or save the results.</quote>said by other user "question but it seems you want blank rows instead of repeating values. In this case, you just want a list of depts with associated employees, but you don't the dept listed over and over. SQL does not easily support this. You could use domain aggregate functions to count the occurrences of specific value in a field, and when it exceeds 1, display null, but that is quite contrived. You could also use 'group by' subqueries with count() to see if you should populate the field or not. Again - quite contrived and a lot of work." "As a side note, your employee number is open to RI issues. If you change an employees dept, the number would also have to be change. I think that would violate 3rd normal form. Better would be to let the database create an autogenerated number for each employee, and then concatenate that to the dept number as a calculated field." best, any query using reference 1 please post me Edited July 3, 2012 by oosrikanth Link to comment Share on other sites More sharing options...
justsomeguy Posted July 3, 2012 Share Posted July 3, 2012 I agree with what you quoted, but I don't know what you're asking from me. I would not do that in SQL. Link to comment Share on other sites More sharing options...
oosrikanth Posted July 7, 2012 Author Share Posted July 7, 2012 I agree with what you quoted, but I don't know what you're asking from me. I would not do that in SQL.if not in sql, in any other language Link to comment Share on other sites More sharing options...
justsomeguy Posted July 9, 2012 Share Posted July 9, 2012 Right, I would use another language, like PHP. Link to comment Share on other sites More sharing options...
oosrikanth Posted July 10, 2012 Author Share Posted July 10, 2012 (edited) Right, I would use another language, like PHP. ok send the program Edited July 10, 2012 by oosrikanth Link to comment Share on other sites More sharing options...
justsomeguy Posted July 10, 2012 Share Posted July 10, 2012 I'm not here to write your code for you, I'm here to help you learn. Let's start with the code you currently use to display the results. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now