User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,013 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,402 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.

Can i retrive different fields of a record as one result.

Join Date: Apr 2008
Posts: 10
Reputation: swingingstars is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
swingingstars swingingstars is offline Offline
Newbie Poster

Re: Can i retrive different fields of a record as one result.

  #5  
Apr 18th, 2008
Originally Posted by AaronASterling View Post
if they are all coming from a single table...call it testTable... then you would just say

  1. SELECT location1, location2, location3 FROM testTable WHERE ....

and then you can fill in whatever goes in the WHERE clause to get the result you want. In general you can list as many fields as you want plus other goodies in the select expression (the part where you tell it what you want) of a SELECT statement. They have to seperated by commas.



that's exactly what i've been using

  1. SELECT location1 a, location2 b , location3 c FROM testTable WHERE a.someField = b.someOtherField AND b.someOtherField = c.someOtherFieldToo


OR LIKE THIS :

  1. SELECT location1 a LEFT JOIN location2 b ON a.someField = b.someOtherField WHERE someOtherField = 'blabla'
Last edited by swingingstars : Apr 18th, 2008 at 2:56 am.
Reply With Quote  
All times are GMT -4. The time now is 9:54 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC