Jump to content

mysql select question


CrosRoad95

Recommended Posts

Posted

is possible to select from mysql using 1 select which output like this in

{
 ["name"]="mynickanem",
 ["other_column"]="kldsjskldjf",
 ["licenses"]={
 	   {
      	["name"]="driver",
     	["ban"]=0,
    	}
    	{
      	["name"]="gun",
      	["ban"]=0,
     	 }
    }
}

from 2 tables "accounts" and "licenses"

Posted

Try this:

 

local nrQuery = dbQuery(dbConnection, "SELECT * FROM accounts UNION SELECT * FROM licenses")
local rQuery = dbPoll(nrQuery, -1)
outputChatBox(toJSON(rQuery))

I dont know if UNION works here.

Posted

I don't think a UNION is quite what he wants, furthermore I doubt it'll even work, considering that this is one of the UNION operators requirements:

Quote

The columns must also have similar data types

This would be more what he wants:

SELECT * FROM players WHERE player_id=? JOIN licenses ON players.player_id=licenses.player_id

...however it'll not give you exactly what you are looking for. Read more on JOINs here: W3Schools

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...