complete newbie maths int function
am 11.03.2006 22:21:46 von NotVeryBright
Hello I,m a complete newbie to this.
In MyTable the ID is an integer which represents a group of people
and a fractional part which indicates a person in that group. e.g.
ID Forename Surname
10.01 John Doe
10.02 Mary Baker
10.03 Baby Doe
1061.01 Jane Brown
1061.02 William Brown
1061.03 Joseph Smith
I've been using ms access and to get all members of a group I used:
SELECT * FROM MyTable WHERE surname = "Doe" AND INT(ID) = 10
(this just part of a much longer statement)
Basically I want to select all people with surname Doe in group ten (in this
particular case)
Moving to MySql I find that INT has a different meaning.
I looked at all the different functions and I'm at a loss
as to how to implement the above
Help Please
Thanks
Best Regards
Re: complete newbie maths int function
am 11.03.2006 23:56:34 von Bill Karwin
"NotVeryBright" wrote in message
news:44133f6b$0$70282$ed2619ec@ptn-nntp-reader03.plus.net...
> Moving to MySql I find that INT has a different meaning.
> I looked at all the different functions and I'm at a loss
> as to how to implement the above
FLOOR is a function that returns the integer portion of a real number.
http://dev.mysql.com/doc/refman/5.0/en/mathematical-function s.html
Though I would ask if you're considering separating the value into two
columns now that you use a database that supports a multi-column primary
key. That would make it so that you don't have to do any calculation to get
the group portion of your value.
Regards,
Bill K.
Re: complete newbie maths int function
am 12.03.2006 00:54:37 von NotVeryBright
Thanks very much Bill for your help.
Yes I've been considering using a separate field for person_in_group_id but
I have many separate (msaccess) databases with just one table (my data only
uses a relational db so that I can use sql to extract data).
however I need to carefully consider how I can use UPDATE from an exported
msaccess file to create an extra field.
I wish I hadn't taken the 'easy route' when I began this project :-))
Once again thanks very much for your help.
Very Best Regards