PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Logiciels d'hébergement > mailing.database.mysql > Seeking silence!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Seeking silence!

Réponse
 
LinkBack Outils de la discussion
Vieux 22/06/2006, 16h17   #1
Thomas Bartkus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Seeking silence!

I just want to assign a variable from a query that returns a single value
result.
The problem is that the following will also emit (print) the result to the
terminal as a side effect.

SELECT @SomeVar := SomeFieldCalculation
FROM ...
WHERE ...

Is there not a simple way to accomplish this silently. IOW - get SELECT to
shut up since it is merely assigning a variable for use further along. Or
is there some other assignment syntax I should use that doesn't involve the
verbose SELECT.

And yes - I do know I can redirect the output to oblivion.

I just think I must be missing something ;-)
Thomas Bartkus


  Réponse avec citation
Vieux 26/06/2006, 21h34   #2
raisinodd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Seeking silence!

It's a bit of a hack, but you can do this:

set @somevar := ( select randomtext from random_table where ... );

Thomas Bartkus wrote:
> I just want to assign a variable from a query that returns a single value
> result.
> The problem is that the following will also emit (print) the result to the
> terminal as a side effect.
>
> SELECT @SomeVar := SomeFieldCalculation
> FROM ...
> WHERE ...
>
> Is there not a simple way to accomplish this silently. IOW - get SELECT to
> shut up since it is merely assigning a variable for use further along. Or
> is there some other assignment syntax I should use that doesn't involve the
> verbose SELECT.
>
> And yes - I do know I can redirect the output to oblivion.
>
> I just think I must be missing something ;-)
> Thomas Bartkus


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h09.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07524 seconds with 10 queries