Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - selecting 2 table at same time /please he
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

selecting 2 table at same time /please he

 Post Reply Post Reply Page  <12
Author
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2004 at 1:43pm

Look at marts link again. The SQL is for any db, Access included.


What I think you want to do is a Left Join - where all rows from the first table are listed along with any rows from the second table that match on a specific key.

The two basic problems with your sql is that it's not identifying which table the fields are coming from and we don't know what key field the two tables have in common that can be used to link them.

  1. Each field you specify in the sql needs to be in the format of tablename.fieldname - e.g. T_WEBLOG.b_published
  2. You need to join the two tables on some key field that is in both tables - e.g. Log_ID, WebLog_Count, ... whatever.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
FARSHAD View Drop Down
Groupie
Groupie


Joined: 21 September 2003
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote FARSHAD Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2004 at 2:32pm

I know
Please read my Question

I told that this code is working fine

 strSQL = "SELECT T_WEBLOG.*, T_IMAGES.* "
  strSQL = strSQL & "FROM T_WEBLOG, T_IMAGES "
  strSQL = strSQL & "WHERE b_published = true "
  strSQL = strSQL & "ORDER BY b_date DESC, b_time DESC;"

the only problem in that I want select top 5 records from table
T_WEBLOG

Just this.
I know its possible 100 percent there is a way for this.
If you think it can be done with LEFT JOIN please write it here for me
because I don`t know how can I use LEFT JOIN with ASP
every time I get error

Thanks

 

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2004 at 4:15pm
Use SELECT TOP 5 instead of SELECT, theres no need for left joins
Back to Top
FARSHAD View Drop Down
Groupie
Groupie


Joined: 21 September 2003
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote FARSHAD Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2004 at 6:01pm
Mart I did it but
it will select top 5 records from those 2 Tables
But I want it Just select 5 top records from one of that tables

Thanks
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.