|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
thanks
thanks I will give it a go
much appreciated FunkyM |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > SQL Query help required |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|