small query issue.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

small query issue.

Post by itsmani1 »

Code: Select all

mysql_query("CREATE TABLE education (
  pid bigint(50) NOT NULL auto_increment,
  userid bigint(50) NOT NULL default '0',
  qualification int(11) NOT NULL default '0',
) ";
mysql_query("
CREATE TABLE user (
  userid bigint(100) NOT NULL auto_increment,
  email varchar(255) NOT NULL default '',
  city varchar(255) default NULL,
  contacted varchar(50) NOT NULL default '',
  notes varchar(255) NOT NULL default '',
  one varchar(50) NOT NULL default '',
  two varchar(50) NOT NULL default '',
  three varchar(50) NOT NULL default '',
  PRIMARY KEY  (userid)
)");
Now i need a query where i can select user.email, user.city and education.qualification order by education.qualification.

thanx in advance.
Mannan.
ody
Forum Contributor
Posts: 147
Joined: Sat Mar 27, 2004 4:42 am
Location: ManchesterUK

Re: small query issue.

Post by ody »

Code: Select all

mysql_query("CREATE TABLE education (
  pid bigint(50) NOT NULL auto_increment,
  userid bigint(50) NOT NULL default '0',
  qualification int(11) NOT NULL default '0',
) ";
should be:

Code: Select all

mysql_query("CREATE TABLE education (
  pid bigint(50) NOT NULL auto_increment,
  userid bigint(50) NOT NULL default '0',
  qualification int(11) NOT NULL default '0'
);");
The query you need is:
select user.email, user.city from user, education where user.userid = education.userid order by education.qualification

Check this out.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Everyone hopes that their website is a huge success .. but using bigint(100) for your contact id is a bit silly.. That could hold approximately 17,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 times the number of people on the planet. Inserting 1000 contacts a second would take 5,390,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 years to fill the table.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

onion2k wrote:Everyone hopes that their website is a huge success .. but using bigint(100) for your contact id is a bit silly.. That could hold approximately 17,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 times the number of people on the planet. Inserting 1000 contacts a second would take 5,390,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 years to fill the table.
Some one is bored :lol:
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

thanx every one for your comments.

Happy New Year
Post Reply