Gossamer Forum
Home : General : Databases and SQL :

problem with select statement

Quote Reply
problem with select statement
hie
i have a database in sql 2000 which i am using in my vb application. my problem comes in when when a want to do some reports using datareport designer in vb.the source of this report is a sql statement of which i want some columns to repeat on the report as the same time restrict the repetition of other columns. what sql statement should i use. below is the statement iam using:
+++++++++++++++++++++++++++++++++++++
SELECT users.uscompany,users.address,users.telphone,users.email,messeges.problem,jobs.reference,jobs.spares,jobs.comments,jobs.dateto,jobs.receiveddate,jobs.starttime,jobs.endtime,jobs.supportstaff,jobs.totaltime,jobs.hourlycharge,pendings.referencess,pendings.receiveddates,pendings.datetos,pendings.starttimes,pendings.endtimes,jobsmaster.jobnumb FROM users,messeges,jobs ,pendings,jobsmaster WHERE messeges.ipaddress=users.ipaddress AND messeges.jobid=jobs.reference and jobs.reference=jobsmaster.jobnumb and pendings.referencess=jobsmaster.jobnumb
+++++++++++++++++++++++++++++++++++++
on this statement i just want the following to repeat;
receiveddate,dateto,starttime,endtime.

what should i do to this statement
Quote Reply
Re: [grantmchingula] problem with select statement In reply to
I don't know why you need to repeat columns, but what you can consider doing is using column aliases, like the following:

tablename.receivedate AS receivedate2
tablename.dateto AS dateto2
tablename.starttime AS starttime2

Just out of curiousity, why aren't you using JOIN functions? It is more efficient to use JOINS rather than selecting from an array list of tables.
========================================
Buh Bye!

Cheers,
Me