Problems with mysql distinct query ... - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Databases - MySQL, SQL, Oracle, Access and others

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-29-2010, 03:24 PM   #1 (permalink)
Regular User
 
Join Date: Nov 2008
Posts: 20
Default Problems with mysql distinct query ...

Hi:

I am very new at this and totally confused as to what query I need. Here is my problem. We have bus trips all over the place and allow our drivers to put a request on routes as they become available. When the driver logs in, a session with his/her id is created. Now, display all the routes that the driver has not requested on. On the example below, when "PB" logs in and the session is created, display trips 1234, 1236, 1237 and 1238. I have a command button that is next to each trip that the driver would click and load a new screen with trip details. My problems is how to limit trips that the driver has NOT put a request on.

$D_Name = $_SESSION['sesdrivername01'];

tblTRIPS:
Trip_Num Trip_From Trip_To
1234AB Dallas Miami
1235AB Ft Worth Montreal
1236AB Houston Phoenix
1237AB Seattle Tacoma
1238AB Portland Vegas
//
//
tblDRIVER:
Driver_Load Driver
1235AB PB
1235AB AJ
1237AB PB


$frmTrip101 = "SELECT DISTINCT Trip_Num,Trip_From,Trip_To,Driver_Load FROM tblTRIPS, tblDRIVER where tblTRIPS.Trip_Num != tblDRIVER.Driver_Load";
pepe_lepew1962 is offline   Reply With Quote
Sponsored Links
Old 04-15-2010, 06:28 AM   #2 (permalink)
Junior Member
 
php_mysql_coder's Avatar
 
Join Date: Apr 2010
Posts: 2
Send a message via MSN to php_mysql_coder
Default Re: Problems with mysql distinct query ...

distinct is not a good way to do what you want. with distinct you just pick out the elements which are different. this is just for avoiding from repetitions.

a simple way to do what you want is building new column and assigning true and false according to the reservations. so you can pick out true ones as reserved ones and false ones as non-reserved ones.

tell me if you need further help or correct me if I missunderstood..

thanks.
php_mysql_coder is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:46 AM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting