Some SQL Syntax

Status
Not open for further replies.

Velaski

winner
Aug 4, 2015
562
165
Making a game in plus emulator and it requires three tables :
- Users
- hoteljobs
- hoteljobs_ranks

I created my two variables:
Code:
int JobId;
int JobRank;
The users table has JobId and JobRank in and working correctly.

In my hoteljobs table:
You must be registered for see images attach

In my hoteljobs_ranks table :
You must be registered for see images attach



What I am trying to do here is use
Code:
Session.GetHabbo().JobId;
Session.GetHabbo().JobRank;
Going to hoteljobs, finding jobid: 5 and then grabbing the name of the job (jobname).
Then going to hoteljobs_ranks , finding the jobid(5), looks for the rankid(1), grabbing the rankname from it.
And I'll consequently be left with the JobName + RankName.

For example:
Code:
Session.GetHabbo().JobId = 5;
Session.GetHabbo().JobRank = 1;
Goes to hoteljobs and locates ID 5. Which is for example Shawn's Kitchen Company
So now the jobname has been grabbed.

Now I want to get the Rankname, with my RankId,
You must be registered for see images attach

So it finds the jobid which is 5, gets my rank id which is 1 and outputs the name into a string variable which I would declare in the code. (string RankName;)

It's the same concept as Roleplay Jobs but I'm going to use it differently, I just need this to work. I don't need it coded for me, I just need some guidance on how to code it.

Kind regards.

I hope this all makes sense, because I'm nearly confused myself.
@Sledmore @Damiens @Meap @Altercationz @Core @JayCustom
 

Attachments

  • upload_2017-1-6_18-1-15.png
    upload_2017-1-6_18-1-15.png
    1.4 KB · Views: 5
Last edited:

Core

Member
Nov 10, 2016
356
138
Making a game in plus emulator and it requires three tables :
- Users
- hoteljobs
- hoteljobs_ranks

I created my two variables:
Code:
int JobId;
int JobRank;
The users table has JobId and JobRank in and working correctly.

In my hoteljobs table:
You must be registered for see images attach

In my hoteljobs_ranks table :
You must be registered for see images attach



What I am trying to do here is use
Code:
Session.GetHabbo().JobId;
Session.GetHabbo().JobRank;
Going to hoteljobs, finding jobid: 5 and then grabbing the name of the job (jobname).
Then going to hoteljobs_ranks , finding the jobid(5), looks for the rankid(1), grabbing the rankname from it.
And I'll consequently be left with the JobName + RankName.

For example:
Code:
Session.GetHabbo().JobId = 5;
Session.GetHabbo().JobRank = 1;
Goes to hoteljobs and locates ID 5. Which is for example Shawn's Kitchen Company
So now the jobname has been grabbed.

Now I want to get the Rankname, with my RankId,
You must be registered for see images attach

So it finds the jobid which is 5, gets my rank id which is 1 and outputs the name into a string variable which I would declare in the code. (string RankName;)

It's the same concept as Roleplay Jobs but I'm going to use it differently, I just need this to work. I don't need it coded for me, I just need some guidance on how to code it.

Kind regards.

I hope this all makes sense, because I'm nearly confused myself.
@Sledmore @Damiens @Meap @Altercationz @Core @JayCustom

Hit me up with a PM with your teamviewer details, will do this for you:p
Don't really understand the post! XD
 
After reading the actual title it made some sense what you was after lmao.. You want something like this query
Code:
SELECT hoteljobs.jobname, hoteljobs_ranks.rankname
    FROM hoteljobs
    INNER JOIN hoteljobs_ranks
        ON hoteljobs.jobid = hoteljobs_ranks.jobid
WHERE hoteljobs.jobid = 'JobId' AND hoteljobs_ranks.rankid = 'JobRank';
 

Velaski

winner
Aug 4, 2015
562
165
Hit me up with a PM with your teamviewer details, will do this for you:p
Don't really understand the post! XD
 
After reading the actual title it made some sense what you was after lmao.. You want something like this query
Code:
SELECT hoteljobs.jobname, hoteljobs_ranks.rankname
    FROM hoteljobs
    INNER JOIN hoteljobs_ranks
        ON hoteljobs.jobid = hoteljobs_ranks.jobid
WHERE hoteljobs.jobid = 'JobId' AND hoteljobs_ranks.rankid = 'JobRank';
I want the result of this to be shown in a whisper composer. How will I go about storing the result in a variable?

EDIT: Fixed
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top