Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

how to fetch records from multiple tables Expand / Collapse
Author
Message
Posted Friday, December 28, 2012 3:40 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 4:40 PM
Points: 2,957, Visits: 4,513
CELKO (12/28/2012)
For a reasonable level of trust, I use the email address + password, like every website on earth. Seems to work well enough for Paypal, Amazon, et al. People do not change them much any more




That CAN'T be serious!! But sadly it is. HOLY IDIOCIES BATMAN! You have NO control over that.

Yahoo and every other free provider AFAIK reclaims email addresses after a certain period of nonuse (say, after the user DIES, rather unavoidable for every user eventually!).

So "JSmith2147" dies, his id is reassigned, and then you email his business info to someone else.

You're one of those consultants that clearly sells only to the pointy-haired manager types who rely solely on perceived reputation and don't have a real clue about the actual implementation details of what you're spouting.


SQL DBA,SQL Server MVP('07, '08, '09)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1401085
Posted Friday, December 28, 2012 5:08 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 4:40 PM
Points: 2,957, Visits: 4,513
CELKO (12/28/2012)
Surely there's some good SQL programmers out there doing exactly what CELKO says they do not do.


I have been at this for 25+ years now and I disagree. Can you give me a scenario where the physical insertion attempt count can have any meaning in a logical data model? How about the blink rate of the front panel of the disk drive?

Back in the original 16-bit minicomputer days on UNIX in the 1970's, the hardware was slow, people did not understand RDBMS and this was assumed to be a way to speed up access. It kept joins short, etc. All you had to give up was data integrity and portability. But we did not know about those things back then. People thought they would always be on one platform, there were no standards and very little theory. And who would have a Terabyte of data on a small machine??

Now move to the 21-st Century. 64-bit hardware, faster and bigger than all of the mainframes on Earth in 1970, SSD, ANSI/ISO Standards and decades of theory and research.

Confession time: when I learned FORTRAN, we had six letter variable names. I got good at inventing six-letter variable names, so I did not stop doing this when I got better FORTRAN compilers and modern languages. I did not realize it was weird and made maintaining code almost impossible for years.




So what do you use to key an Order header table if not Order#? ... After all, orders don't have email addresses!


SQL DBA,SQL Server MVP('07, '08, '09)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1401097
Posted Friday, December 28, 2012 9:49 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:15 PM
Points: 38,025, Visits: 34,949
CELKO (12/27/2012)
[quote]but a good SQL programmer never uses IDENTITY for a key


Another fine load of passive aggressive name calling hooie. Stop it or, since you seem incapable, just go away.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1401117
Posted Friday, December 28, 2012 9:51 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:15 PM
Points: 38,025, Visits: 34,949
CELKO (12/28/2012)
[quote]Can you give me a scenario where the physical insertion attempt count can have any meaning in a logical data model?


Sure... but first, give us a good example of what you would design a Primary Key to be for a customer table and explain why.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1401119
Posted Friday, December 28, 2012 10:04 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:15 PM
Points: 38,025, Visits: 34,949
Sean Lange (12/28/2012)
First of all, SSN have and will be reused. When people die their SSN gets recycled into the available pool.


While it is true that a person can change their SSN, it's a myth that SSNs are recycled. Please see Q20 on the following webpage which is on the official Social Security website.
http://www.socialsecurity.gov/history/hfaq.html

There was one incident many years ago where some secretary had her SS card used as a demo card in wallets and some huge number of people claimed it as their own, but Social Security numbers have not been reused to date.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1401121
Posted Friday, December 28, 2012 10:18 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:15 PM
Points: 38,025, Visits: 34,949
CELKO (12/28/2012)
{ISO-11179 rules for data element names} Which can be downloaded where?


http://metadata-standards.org/Document-library/Documents-by-number/WG2-N1551-N1600/WG2N1580_WD_11179-5_Ed3.pdf

But you will sorry. Reading standards is like reading the law; it took me two years on ANSI X3H2 to get comfortable with the language. I would start with some of my stairway stuff on the basics:


And yet you continue to bash people about learning a standard that you've just said they'd be sorry for reading. Stop pushing that garbage. Teach them the right way to do it instead. If you believe that your "stairway" article is more effective, then start posting that instead of bothering people with useless rhetoric about a standard that even took you a long time to understand.



--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1401123
Posted Friday, December 28, 2012 10:33 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:15 PM
Points: 38,025, Visits: 34,949
manibad (12/27/2012)
i have Demo,elections and electionshist tables where i should neglect the pepole who have status='t' from demo table and for those who are not neglected i should check whether electionstartdate is null and electionterminationdate is not null from election table then for these people i should check in electionhist table that whether the person has electionstartdate is not null(the value must be fetched from the top most load.
In demo and election tables we have nearly 50000 -60000 records but in electionhist tables nearly 10000000 records are there.
Can anyone please suggest me in pulling records when a situation prevails like this....i am able to do it but it takes a longer time....i need to pull it in mins.
I have given you the entire picture of the situation..Pleas go through this and let me know your suggestions.Thanks in advance

{snip}

If you are not clear with this please let me know i will explain you more.


Although people can certainly make recommendations to you about the code you've posted, they probably won't be able to help you really come to the right conclusions because the don't have your data and you've not provided the right kind of information.

Please see the article at the second link in my signature line below for how to post the correct information to get a performance problem of this nature solved.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1401133
Posted Monday, December 31, 2012 8:30 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 4:40 PM
Points: 2,957, Visits: 4,513
Jeff Moden (12/28/2012)
Sean Lange (12/28/2012)
First of all, SSN have and will be reused. When people die their SSN gets recycled into the available pool.


While it is true that a person can change their SSN, it's a myth that SSNs are recycled. Please see Q20 on the following webpage which is on the official Social Security website.
http://www.socialsecurity.gov/history/hfaq.html

There was one incident many years ago where some secretary had her SS card used as a demo card in wallets and some huge number of people claimed it as their own, but Social Security numbers have not been reused to date.



That seems to imply that someone can change his/her SSN at will. I don't believe that's true.

But a SSN can change. I would think the most common reason is a non-citizen with a "SSN" as a tax number becoming a citizen. He/She must be assigned a new SSN, as non-citizen numbers come from a different pool (or least they used to). A leading "000", for example, was reserved for non-citizens.


SQL DBA,SQL Server MVP('07, '08, '09)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1401405
Posted Monday, December 31, 2012 10:02 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 4:40 PM
Points: 2,957, Visits: 4,513
CELKO (12/31/2012)
That seems to imply that someone can change his/her SSN at will. I don't believe that's true.


Yep, you can. And thanks to identity theft this is becoming more common to do this.

I had a friend who worked in the Nordic countries years ago. His government ID number include his birth date in it and code for the place of birth. But they screwed up and gave him Feb 30 or some other impossible date. All of the car rentals, etc rejected him!


NO, you CAN'T. The SSN administration has to approve it. You have to have a valid reason to do it, you can't just arbitrarily ("at will") decide to change your number.

Do you have ANY link to show that you can change your SSN at will, any time you want??


SQL DBA,SQL Server MVP('07, '08, '09)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1401428
Posted Monday, December 31, 2012 11:11 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 9:25 AM
Points: 169, Visits: 390
Select *
from demo d
INNER JOIN elections e ON e.sno = d.sno
Inner join electionshist esh ON esh.ssno = e.ssno and esh.sno = d.sno
where d.status <> 't'
and e.electionstartdate is null
and e.electionstermdate is not null


Is this what you are looking for???


Good Luck :) .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Post #1401453
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse