Jump to content

[SOLVED] SYNTAX


jaymc

Recommended Posts

SELECT cvn.clientID

        FROM wecan.client_virtual_numbers cvn

        INER JOIN wecan_{I NEED THIS TO BE VALUE OF cvn.clientID}.table

        WHERE cvn.number = '145'

 

 

WHERE I have {I NEED THIS TO BE VALUE OF cvn.clientID} that IS the name of the database e.g wecan_4

Can this be done?

 

 

Something like this would be nice

 

SELECT cvn.clientID
        FROM wecan.client_virtual_numbers cvn
        INER JOIN wecan_(SELECT clientID from wecan.client_virtual_numbers where number = '145').table
        WHERE cvn.number = '145'

 

 

Link to comment
https://forums.phpfreaks.com/topic/175376-solved-syntax/
Share on other sites

At the moment the code is kinda pointless...

 

The syntax is a little wrong, but putting that to one side you're only SELECTing the `clientID`.

 

What are the table structures, and what are you hoping to get from each table? What's the initial value you have to pull the correct row(s)?

Link to comment
https://forums.phpfreaks.com/topic/175376-solved-syntax/#findComment-924208
Share on other sites

Im a bit limited, this is for use with SMS, i receive a post which contains only a number

 

in a table I have that number along with a clientID

 

the clientID is actually part of the customers database name e.g.

 

wecan_{clientID} = a customers database:-

wecan_1 = customers database 1

wecan_2 = customers database 2

wecan_3 = customers database 3

wecan_4 = customers database 4

 

The problem is, the POST with the number does not contain the clientID therefor I cant join the customers DB without first knowing what the customers clientID is.

 

I could do a query to first fetch this then run another query, but I am trying to put this all in one query..

Link to comment
https://forums.phpfreaks.com/topic/175376-solved-syntax/#findComment-924217
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.