MySQL joined select

Pete pete at mollysrevenge.com
Tue Mar 20 12:29:07 EDT 2012


Hi Marek,
I think you're confusing what you get back from the SELECT statement with
what you display to your users - they are two different things.  I'm going
to assume that you need all the columns you name in your SELECT statement
for some processing reasons but that doesn't mean you have to show them all
to your users.  Once you get the data back from the SELECT, it's up to you
which columns you put in a filed, datagrid, or any other Livecode control.

Maybe  you're thinking that you have to SELECT the column because you refer
to it elsewhere in the SELECT statement, but that's not the case.  You can
refer to any columns form the selected tables anywhere in your SELECT even
if they are not explicitly selected.

Pete

On Tue, Mar 20, 2012 at 2:20 AM, Marek Reichenbach <
reichenbach.marek at gmail.com> wrote:

> Thanks for the replies.
> I've made it workin, but I wanna add something else:
>
> So the question in SQL is:
>
> Maybe there is a way to hide columns it the result, like:
> SELECT car_nr, model, travel_days FROM table1,table2 WHERE number <> 414
> AND (car_nr > truck_nr) from transport;
> and show only result of the colums travel_days, but ONLY on*
> **separate* columns
> and  HIDE OTHER COLUMNS.
>
> I've posted here more detailed:
> http://forums.runrev.com/viewtopic.php?f=12&t=11426&p=53702#p53702
> Help please...
>
> On 20 March 2012 01:09, Pete <pete at mollysrevenge.com> wrote:
>
> > Seems like either Peter or Mark's solution would be a lot better than
> > trying to do it with an SQL SELECT, but I'm also not sure of what Marek
> is
> > trying to achieve - seems strange to want to replace all the numbers with
> > plus signs.  Maybe he wants a floating plus sign at the start of the
> > number, dunno.
> > Pete
> >
> > On Mon, Mar 19, 2012 at 3:50 PM, Peter M. Brigham, MD <pmbrig at gmail.com
> > >wrote:
> >
> > > repeat with n = 1 to length(tInput)
> > >   if char n of tInput is a number
> > >   then put "+" into char n of tInput
> > >   else put "-" into char n of tInput
> > > end repeat
> > >
> > > Or am I missing something?
> > >
> > > -- Peter
> > >
> > > Peter M. Brigham
> > > pmbrig at gmail.com
> > > http://home.comcast.net/~pmbrig
> > >
> > > On Mar 19, 2012, at 5:15 PM, Pete wrote:
> > >
> > > > I wonder if there might be a less ugly way to do this in LC instead
> of
> > > > SQL...
> > > > Pete
> > > >
> > > > On Mon, Mar 19, 2012 at 2:04 PM, Marek <reichenbach.marek at gmail.com>
> > > wrote:
> > > >
> > > >> Thanks a lot! That helped me a lot man.
> > > >>
> > > >> Marek Reichenbach
> > > >>
> > > >> On 2012 Kov. 19, at 19:29, Ken Ray <kray at sonsothunder.com> wrote:
> > > >>
> > > >>>
> > > >>> On Mar 19, 2012, at 3:44 AM, Marek Reichenbach wrote:
> > > >>>> when i get for example: 1234567 -> i should get result +++++++,
> > > 123-56-
> > > >> I
> > > >>>> would get +++-++- .
> > > >>>
> > > >>> The only way I know is kind of ugly, requiring seven nested REPLACE
> > > >> statements:
> > > >>>
> > > >>> SELECT
> > > >>
> > >
> >
> REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("123-56-","1","+"),"2","+"),"3","+"),"4","+"),"5","+"),"6","+"),"7","+")
> > > >>>
> > > >>> This would return:
> > > >>>
> > > >>> +++-++-
> > > >>>
> > > >>>
> > > >>> Ken Ray
> > > >>> Sons of Thunder Software, Inc.
> > > >>> Email: kray at sonsothunder.com
> > > >>> Web Site: http://www.sonsothunder.com/
> > > >>>
> > > >>> _______________________________________________
> > > >>> use-livecode mailing list
> > > >>> use-livecode at lists.runrev.com
> > > >>> Please visit this url to subscribe, unsubscribe and manage your
> > > >> subscription preferences:
> > > >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> > > >>
> > > >> _______________________________________________
> > > >> use-livecode mailing list
> > > >> use-livecode at lists.runrev.com
> > > >> Please visit this url to subscribe, unsubscribe and manage your
> > > >> subscription preferences:
> > > >> http://lists.runrev.com/mailman/listinfo/use-livecode
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > Pete
> > > > Molly's Revenge <http://www.mollysrevenge.com>
> > > > _______________________________________________
> > > > use-livecode mailing list
> > > > use-livecode at lists.runrev.com
> > > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > >
> > > _______________________________________________
> > > use-livecode mailing list
> > > use-livecode at lists.runrev.com
> > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > >
> >
> >
> > --
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list