SunQuest
 
           General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 29th, 2003, 05:19 PM
funkyM funkyM is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Australia
Posts: 13 funkyM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL Query help required

This is a simple one but not simple for me as I am still learning and can't quite get the syntax right.

What I want to do is select a row of data from the table `biz_listing` that belongs to the correct user. The list of users are stored in another table called `user`.

The two tables are connected by the field `user_id`.

Could someone please give me the query for this

Here is the structure of the two tables.

CREATE TABLE user (
user_id varchar(20) NOT NULL default '',
first_name varchar(30) NOT NULL default '',
last_name varchar(40) NOT NULL default '',
username varchar(30) NOT NULL default '',
password varchar(20) NOT NULL default '',
email varchar(60) NOT NULL default '',
rec_newsletter int(1) NOT NULL default '0',
PRIMARY KEY (user_id)
) TYPE=MyISAM;


CREATE TABLE biz_listing (
user_id varchar(20) NOT NULL default '',
biz_id int(10) NOT NULL auto_increment,
biz_name varchar(200) NOT NULL default '',
description text NOT NULL,
address varchar(200) NOT NULL default '',
phone varchar(12) NOT NULL default '',
fax varchar(12) default NULL,
email varchar(100) default NULL,
url varchar(200) default NULL,
PRIMARY KEY (user_id,biz_id),
FULLTEXT KEY biz_name (biz_name,description)
) TYPE=MyISAM;



Many thanks, I truly appreciate all of your help

Funky

Reply With Quote
  #2  
Old January 29th, 2003, 10:42 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Try this...

SELECT biz_listing.* FROM biz_listing, user WHERE biz_listing.user_id = user.user_id ORDER BY biz_name
__________________
Regards,
Ramiro Varandas Jr.

Reply With Quote
  #3  
Old January 30th, 2003, 04:42 AM
funkyM funkyM is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Australia
Posts: 13 funkyM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks

thanks I will give it a go

much appreciated

FunkyM

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > SQL Query help required


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway