Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Finding what records do not match

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-06-07 : 16:52:51
I have two tables which are used in an inner join and have come to find out that one table has 5 less records then the other. Now since they are supposed to contain the exact same amount of records I need to find out which ones are missing. I do not know much about joins but everthing I do know only returns the rows that match, not the rows that do not match.

Here is the select statment that I use to inner join the two tables when I want the resulting matches, if it helps

select weapon_general.weapon, weapon_general.weapon_class, weapon_general.min_level, weapon_general.damage, weapon_general.deley, weapon_general.type, weapon_general.extra, weapon_drop.get_type, weapon_drop.recipe from weapon_general inner join weapon_drop on weapon_general.weapon = weapon_drop.weapon

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-06-07 : 16:58:09
Look at Books on Line for "Left Outer Join" and "Where Not Exists". Either of those techniques will solve you problem.

EDIT: and while you're in there looking around, notice how the sql code is formatted. Formatting and table aliases will make the code much easier to read.

Be One with the Optimizer
TG
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-06-07 : 17:09:57
quote:
Originally posted by TG

Look at Books on Line for "Left Outer Join" and "Where Not Exists". Either of those techniques will solve you problem.

EDIT: and while you're in there looking around, notice how the sql code is formatted. Formatting and table aliases will make the code much easier to read.

Be One with the Optimizer
TG



Thank you I will look those up, as for formatting I am pritty much against it. I have more problems reading the standered format over my single lines, but if you like formatting use it.

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.
Go to Top of Page

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-06-07 : 18:44:05
quote:
as for formatting I am pritty much against it.


Are you kidding? Im sure the forum community would rather view it as such:

select 	 wg.weapon 
,wg.weapon_class
,wg.min_level
,wg.damage
,wg.deley
,wg.type
,wg.extra
,wd.get_type
,wd.recipe
from weapon_general wg
inner join weapon_drop wd on weapon_general.weapon = weapon_drop.weapon


So, if not for yourself, at least format it for the rest of us :)
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-06-07 : 22:10:13
quote:
Originally posted by nathans

quote:
as for formatting I am pritty much against it.


Are you kidding? Im sure the forum community would rather view it as such:

select 	 wg.weapon 
,wg.weapon_class
,wg.min_level
,wg.damage
,wg.deley
,wg.type
,wg.extra
,wd.get_type
,wd.recipe
from weapon_general wg
inner join weapon_drop wd on weapon_general.weapon = weapon_drop.weapon


So, if not for yourself, at least format it for the rest of us :)



Nope not kidding. If you ever look at any of my code you will notice it follows no normal formating conventions.

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-06-07 : 22:22:40
It also doesn't work the way you want, so who is correct ?


Damian
Ita erat quando hic adveni.
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-11-28 : 15:28:43
It does not work the way I want beacuse I am using the wrong commands. It has nothing to do with formating. If you like to format your code and it makes it easier for you to read then fine, do that. I will code my own way and you can code yours.

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-11-28 : 17:25:00
Except my code works, and it does so in front of millions of people every year.

You have been asking the same questions here for 3 years and don't appear to be any more knowledgable for it.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-11-29 : 01:07:49
My code does work, I have written may T-SQL scripts that work perfectly fine with out formating them. I only ask questions because I did not understand T-SQL well enough to develop my code my self.

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-11-29 : 01:17:34
quote:
Nope not kidding. If you ever look at any of my code you will notice it follows no normal formating conventions.


Ooh, and have I seen your code (ugh)! You must have worked for years down here in Adelaide...

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-11-29 : 01:45:33
I have no idea wher Adelaide is, I will just assume that it is an Australian city. If you people hate the fact that I do not code the same way you do just tell me to stop coming here for help and I will. But you have no right to tell me my code is crap just because of it's formating. We all code differantly, we code the way that works best for us. And if it turns out I can code better with no formating then that is how I am going to code. Now I know I probibily asked some really basic questions in my first year here but I came here because I was told this was the best place to get help with SQL, but maybe I should go back to my freinds and correct his statmetn "SQLteam.com is the best place to get help if you don't like coding in your own style" And yes before you start pointing out my crappy spelling I know about it so just keep those comments to your self.

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-12-01 : 17:25:30
Sorry Eagle,

I should have warned you that in Australia we like to rub people a little bit on their sore points....we call it national catharsis. I doubt anyone here hates anything about you - considering they don't know you from a bar of soap.

So , apologies for the cultural insensitivity...my humourous streak occasionally gets the better of me.

(I dare not mention the night elf )

But in case you're up for a reasoned discussion about it, personally I reckon that getting code to work is about 20% of the task, and making it maintainable by some other guy you've never met, who's probably tackling SQL for the first time and has been told to make some major change at midnight because the minister has just declared a fare-free day on the trains tomorrow - well to my mind that's 80% of the task.

For me, its pretty much all about making myself redundant and making it absolutely trivial for someone who has no clue whatsoever to make a change if needed (because even though it shouldn't be what happens - that's the real world).

Hence why I'm for clear formatting and readability. And hence my heartless and insensitive remark...



--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-12-01 : 17:35:09
quote:

But you have no right to tell me my code is crap just because of it's formating.



Ahh you're funny.
You have provided me with a lot of entertainment over the years here Eagle, I thank you.

The reason formatting was brought up, is because you are asking for help. If you want help, it's polite to make your code readable to the people you would like helping you, but whatever. You have never followed a single bit of advice given here.

Keep it up!



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-12-01 : 17:44:13
soundslikeeagledoesn'tworkinateamenvironmentsoformattinghasnotbee
nanissueforhim.perhapsjusttomakethingseasieronushecouldformathisc
odewhenhepostsquestionshere.otherwisecodeanywayyouwantto,i'mjustg
oingtogivinguptryingtoreadit.

I certainly don't hate you Eagle, just jumpin' on the bandwaggon to have some fun

Be One with the Optimizer
TG
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-12-01 : 17:48:17
Eagle_f90,

Are you the sole developer wherever you work? If so, I can understand why you have gotten away with not formatting your code. In an environment where there are multiple developers, like most larger organizations, you would not be allowed to do this. Failure to comply with standards would get you terminated.

Feel free to not format your own code, but when asking for free help, make sure to format it to make it easier for us to help you.

Tara Kizer
aka tduggan
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2005-12-01 : 17:50:09
I quite like badly formatted code: it gives your fingers something to do while you're working out what's wrong with the logic.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-12-01 : 17:54:52
Can't quibble with that.

Hey lets start a list of the benefits of poorly formatted and documented code!
1. it gives your fingers something to do while you're working out what's wrong with the logic
2. it means lots of easy money for yours truly when the original developer gives up because he can't maintain it anymore
3. It drastically extends the life of your space bar / tab
4. It makes it really hard for people to figure out what a terrible developer you are.
5. it supports the burgeoning 3rd party industry for automatic code-formatting tools!
6. - more?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-12-01 : 18:17:23
quote:
Originally posted by rrb

3. - more?



It drastically extends the life of your space bar / tab.

Nathan Skerl
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-01 : 20:48:21
4. It makes it really hard for people to figure out what a terrible developer you are.


Well, not really. My experience is that poorly formatted code is about a 100% accurate indicator that the person who wrote it is a terrible developer.



quote:
Originally posted by rrb

Can't quibble with that.

Hey lets start a list of the benefits of poorly formatted and documented code!
1. it gives your fingers something to do while you're working out what's wrong with the logic
2. it means lots of easy money for yours truly when the original developer gives up because he can't maintain it anymore
3. It drastically extends the life of your space bar / tab
4. - more?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"



CODO ERGO SUM
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-12-02 : 05:20:39
quote:
Originally posted by tkizer

Eagle_f90,

Are you the sole developer wherever you work? If so, I can understand why you have gotten away with not formatting your code. In an environment where there are multiple developers, like most larger organizations, you would not be allowed to do this. Failure to comply with standards would get you terminated.

Feel free to not format your own code, but when asking for free help, make sure to format it to make it easier for us to help you.

Tara Kizer
aka tduggan



All the code I write is for my personal websites. I do not code for any company.

quote:
Originally posted by TG

soundslikeeagledoesn'tworkinateamenvironmentsoformattinghasnotbee
nanissueforhim.perhapsjusttomakethingseasieronushecouldformathisc
odewhenhepostsquestionshere.otherwisecodeanywayyouwantto,i'mjustg
oingtogivinguptryingtoreadit.

I certainly don't hate you Eagle, just jumpin' on the bandwaggon to have some fun

I do work in a team enviroment but I do not do programing. Programing to me is a hobby and not a job.

Be One with the Optimizer
TG



quote:
Originally posted by Merkin

quote:

But you have no right to tell me my code is crap just because of it's formating.



Ahh you're funny.
You have provided me with a lot of entertainment over the years here Eagle, I thank you.

The reason formatting was brought up, is because you are asking for help. If you want help, it's polite to make your code readable to the people you would like helping you, but whatever. You have never followed a single bit of advice given here.

Keep it up!



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson


You can not say I have never followed a single bit of advice given here, I have followed most of it (when I understod it) Heck in this thread I was advied to cehck books online for left outter join and where not exists and since I did check those I have written a few T-SQL scripts for my site that use those conditions, including the one for the orignal issue here.

If you really belive that not formating my code makes me such a crappy coder please give a good reason why I should format code and make it harder for me to read when these scripts are for my personal use (note the @all comment below)



@All

I do understand your point on formating when asking for help and I have actualy recently aquired a program that I can take my unformated code and have it format it for me before I post on a forum for questions.

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2005-12-02 : 05:30:18
quote:
Originally posted by rrb

Can't quibble with that.

Hey lets start a list of the benefits of poorly formatted and documented code!
1. it gives your fingers something to do while you're working out what's wrong with the logic


I was meaning the benefits of trying to work on someone else's badly-formatted code. I wasn't being completely facetious: I really do find it therapeutic to be able to reformat the stuff as I work out what the original developer had in mind, and where they'd gone wrong.
Go to Top of Page
    Next Page

- Advertisement -