Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Union and Joins
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Union and Joins

 Post Reply Post Reply
Author
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Topic: Union and Joins
    Posted: 11 November 2004 at 8:44am
I have 3 tables:
Tabel 1- tblLogin (only relevant fields)
UserName,  BUM (Business Unit Manager), ASM (Area Sales Manager)
Tabel 2 - tblWork1
strSeenBy, strData
Tabel 3 - tblWork2
strSeenBy, strData
Tabel 4 -tblWork3
strSeenBy, strData
strSeenBy = UserName

Table 1 is holding the informations about all users. Table 2-4 holds information about users work. In one day, a user might have records in 1, 2 or all 3 tblWork. What I need is to print a report on how many working days (strData) has each users.
In order to find out how many working days has a single user, I use UNION SELECT DISTINCT strData with all table from 2-4. I don't know how to make is loop through table1 to count this for all the user belonging to an BUM(ASM).
To distinct between ASM and BUM I have a an If-then:
If UserISBUM then
sql for BUM
Else
sql for ASM
End if.
Cristian Banu
Soft 4 web
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 15 November 2004 at 5:36am

SQL = "SELECT Count(tablename.fieldname) AS BUM FROM tablename where Field = UserISBUM"

BUM = Connection("BUM")

BUM = number

hope that answers your question the above code counts the number of records with x spec.

just reading do you mean you can get it to make the report with just the first record

you want to use

do while NOT connection.eof

code

connectoion.movenext

loop

 

Back to Top
 Post Reply Post Reply

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.